Skip to content

Instantly share code, notes, and snippets.

@benbonnet
Created May 28, 2009 14:02
Show Gist options
  • Save benbonnet/119315 to your computer and use it in GitHub Desktop.
Save benbonnet/119315 to your computer and use it in GitHub Desktop.
#################################################################
# VENUE SEARCH => http://www.lastfm.fr/api/show?service=396 #
# TRACK SEARCH => http://www.lastfm.fr/api/show?service=286 #
# ARTIST SEARCH => http://www.lastfm.fr/api/show?service=272 #
# ALBUM SEARCH => http://www.lastfm.fr/api/show?service=357 #
#################################################################
@keyword = params[:search][:keyword]
keyword = CGI::escape(@keyword)
api = "xxxxx"
method = "artist.search"
@url = "http://ws.audioscrobbler.com/2.0/?method=#{method}&artist=#{keyword}&api_key=#{api}"
@doc = Hpricot.parse(open(@url))
render(:update) do |page|
page.replace_html "api_content", :partial => "lastfm/search"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment