dots


dots / scripts / Scripts
xxwhirlpool  ·  2026-01-21

lastfm.sh

 1#!/bin/bash
 2
 3apikey=$(pass api/lastfm)
 4user="springpool"
 5
 6URL="https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=$user&api_key=$apikey&format=json&limit=1"
 7
 8artist=$(curl -s ${URL} | jq -r '.recenttracks.track[0].artist."#text"')
 9album=$(curl -s ${URL} | jq -r '.recenttracks.track[0].album."#text"')
10song=$(curl -s ${URL} | jq -r '.recenttracks.track[0].name')
11
12printf "$artist"
13
14printf "\n$album\n$song"