Extrair dados da Last.fm

Exercite casualmente a API Last.fm a partir da linha de comando, adicionando o seguinte ao seu .bashrc:

fm()
{
declare API_KEY
=... # TODO: get API key.
curl
-s
-d"api_key=$API_KEY"
$
{1:+"-dmethod=$1"}
$
{2:+"-d$2"} ${3:+"-d$3"} ${4:+"-d$4"} ${5:+"-d$5"}
$
{6:+"-d$6"} ${7:+"-d$7"} ${8:+"-d$8"} ${9:+"-d$9"}
'http://ws.audioscrobbler.com/2.0'
}

Exemplos:

# Find artists similar to Surfer Blood.
$ fm artist
.getSimilar artist=Surfer Blood|grep '<name>'
<name>Wavves</name>
<name>Real Estate</name>
<name>Smith Westerns</name>
...

# Read insightful track comments.
$ fm track
.getShouts track=Yesterday artist=The Beatles
<shout>
<body>YESTEHDAYYYY, ALL MY TROUBLES SEEMED SO FAR AWAYYYYYYYY... lol</body>
<author>alexia_N</author>
<date>Fri, 6 Apr 2012 04:44:56</date>
</shout>
...