~dricottone/blog

ref: 237b8cdd8dc02f2cf9d8d248ba66ab2fa71eb903 blog/scripts/lastfm.sh -rwxr-xr-x 740 bytes
237b8cddDominic Ricottone Updated draft flag 11 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>"