_ _ | | _ _ | | | | | | | | | | | | _ _ | | | | _ _ | | | || || || | MusixMatch is a wrapper for the musixmatch.com API's. | || || || | | || || || | With this library you can search for lyrics and tracks | || || || | | | || || | using the http://musixmatch.com service. | | || || | | | | | | | | | \ / \ / ---------- ----------
gem install musix_match
require 'musix_match' MusixMatch::API::Base.api_key = 'YOUR_API_KEY'
response = MusixMatch.search_track(:q_artist => 'Pantera') if response.status_code == 200 response.each do |track| puts "#{track.track_id}: #{track.track_name} (#{track.artist_name})" end end
Available options for the search_track methods are:
-
q: a string that will be searched in every data field
-
q_track: string to be searched among tracks titles
-
q_artist: string to be searched among artists names
-
page: requested page of results
-
page_size: desired number of items per result page
-
f_has_lyrics: exclude tracks without an available lyrics
response = MusixMatch.get_lyrics(track_id) if response.status_code == 200 && lyrics = response.lyrics puts lyrics.lyrics_body end
response = MusixMatch.get_track(track_id) if response.status_code == 200 && track = response.track puts "#{track.track_name} (#{track.artist_name})" puts "Lyrics id: #{track.lyrics_id}" end
puts MusixMatch.i_m_feeling_lucky("Guns'n'Roses - Welcome to the jungle")
The Lyrics object has the following attributes:
-
lyrics_id
-
lyrics_body
-
lyrics_language
-
script_tracking_url
-
lyrics_copyright
-
track_name
-
artist_name
The track object has the following attributes:
-
track_id
-
track_mbid
-
track_name
-
track_mbid
-
track_length
-
lyrics_id
-
instrumental
-
subtitle_id
-
artist_id
-
artist_mbid
-
artist_name
-
artist_mbid
-
album_name
-
album_id
-
album_coverart_100x100
MusixMatch.post_feedback(track_id, lyrics_id, feedback_type)
Feedback type should be one of the following:
-
wrong_attribution (the lyrics shown are not by the artist that I selected.)
-
bad_characters (there are strange characters and/or words that are partially scrambled.)
-
lines_too_long (the text for each verse is too long!)
-
wrong_verses (there are some verses missing from the beginning or at the end.)
-
wrong_formatting (the text looks horrible, please fix it!)
-
Repository: git://github.com/pilu/musix_match.git
-
Musixmatch site: musixmatch.com
-
Musixmatch API: developer.musixmatch.com
Andrea Franz - gravityblast.com