~dricottone/blog

blog/scripts/lastfm.sh -rwxr-xr-x 740 bytes
eb40f8f6Dominic Ricottone RSS feeds 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

PASSWD="$(cat lastfm-passwd)"

USER="al__dente"
URI="https://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=${USER}&api_key=${PASSWD}&format=json&period=1month&limit=5"
FEED="$(curl --get --no-progress-meter "$URI" | jq --raw-output '[.toptracks.track[] | {track: .name, artist: .artist.name}]')"

echo "<ol>"
echo "${FEED}" | jq --raw-output '.[0] | "  <li>\(.track) by \(.artist)</li>"'
echo "${FEED}" | jq --raw-output '.[1] | "  <li>\(.track) by \(.artist)</li>"'
echo "${FEED}" | jq --raw-output '.[2] | "  <li>\(.track) by \(.artist)</li>"'
echo "${FEED}" | jq --raw-output '.[3] | "  <li>\(.track) by \(.artist)</li>"'
echo "${FEED}" | jq --raw-output '.[4] | "  <li>\(.track) by \(.artist)</li>"'
echo "</ol>"