Complete async/await support • Cross-platform • Powerful CLI tools
# Search for artists
$ lastfm artist search "The Beatles"
# Get top tracks
$ lastfm chart top-tracks --limit 10
import LastFMKit
// Create a client
let client = LastFMClient()
// Search for artists
let results = try await client.artist.search(
"The Beatles",
limit: 10
)
// Get user's recent tracks
let recent = try await client.user.getRecentTracks(
"rj",
limit: 50
)
Built with async/await, Codable, and protocol-oriented design
macOS, iOS, tvOS, watchOS, and Linux support
API credentials managed by Cloudflare Worker
All Last.fm endpoints with strongly-typed models
Test every API endpoint from your terminal
Built-in retry policies and timeout handling
Explore the Last.fm API from your terminal
$ lastfm artist info "Radiohead"
🎤 Radiohead
📊 Statistics:
Listeners: 5,436,823
Playcount: 584,291,456
🏷️ Tags:
• alternative
• rock
• indie
• electronic
• experimental
📝 Biography:
Radiohead are an English rock band formed in Abingdon,
Oxfordshire, in 1985. The band consists of Thom Yorke,
brothers Jonny Greenwood and Colin Greenwood, Ed O'Brien
and Philip Selway...
🔗 Links:
Last.fm: https://www.last.fm/music/Radiohead
Official: https://radiohead.com
$ lastfm user recent-tracks "rj" --limit 5
🎵 Recent Tracks for rj
1. The Less I Know The Better
by Tame Impala
from Currents
🕐 2 minutes ago
2. Redbone
by Childish Gambino
from "Awaken, My Love!"
🕐 6 minutes ago
3. Electric Feel
by MGMT
from Oracular Spectacular
🕐 10 minutes ago
4. Midnight City
by M83
from Hurry Up, We're Dreaming
🕐 14 minutes ago
5. Feel It All Around
by Washed Out
from Life of Leisure
🕐 18 minutes ago
$ lastfm chart top-artists --limit 5
📈 Global Top Artists
1. Taylor Swift
Listeners: 5,832,197
Playcount: 456,234,891
2. The Weeknd
Listeners: 5,234,652
Playcount: 398,765,234
3. Arctic Monkeys
Listeners: 4,987,234
Playcount: 376,543,210
4. Lana Del Rey
Listeners: 4,765,432
Playcount: 356,789,012
5. Radiohead
Listeners: 4,543,210
Playcount: 334,567,890
$ lastfm album search "Dark Side" --limit 3
💿 Album Search Results
1. The Dark Side of the Moon
by Pink Floyd
🎵 Tracks: 10
🏷️ progressive rock, psychedelic rock
2. Dark Side of the Moon
by Mary Fahl
🎵 Tracks: 10
🏷️ female vocalists, cover
3. Dark Side
by Kelly Clarkson
🎵 Tracks: 1
🏷️ pop, female vocalists
$ lastfm track similar "Bohemian Rhapsody" "Queen"
🎵 Similar to Bohemian Rhapsody by Queen
1. Stairway to Heaven
by Led Zeppelin
Match: 98.5%
2. Hotel California
by Eagles
Match: 96.2%
3. Comfortably Numb
by Pink Floyd
Match: 94.8%
4. November Rain
by Guns N' Roses
Match: 93.1%
5. Dream On
by Aerosmith
Match: 91.7%
$ lastfm artist search "Daft Punk"
🔍 Artist Search Results
1. Daft Punk
Listeners: 4,521,987
🔗 https://www.last.fm/music/Daft+Punk
2. Daft Punk Tribute
Listeners: 12,543
🔗 https://www.last.fm/music/Daft+Punk+Tribute
3. Daft Punk vs. Stardust
Listeners: 8,234
🔗 https://www.last.fm/music/Daft+Punk+vs.+Stardust
$ lastfm user top-artists "rj" --period 3month
🎤 Top Artists for rj (3 months)
1. Tame Impala
Playcount: 847 plays
2. Mac DeMarco
Playcount: 692 plays
3. King Gizzard & The Lizard Wizard
Playcount: 523 plays
4. Unknown Mortal Orchestra
Playcount: 487 plays
5. Pond
Playcount: 412 plays
$ lastfm track search "Around the World"
🎵 Track Search Results
1. Around the World
by Daft Punk
Listeners: 1,234,567
2. Around the World
by Red Hot Chili Peppers
Listeners: 987,654
3. Around the World (La La La La La)
by ATC
Listeners: 543,210
$ lastfm geo top-artists "Sweden" --limit 5
🌍 Top Artists in Sweden
1. The Weeknd
Listeners: 234,567
2. Taylor Swift
Listeners: 198,765
3. Veronica Maggio
Listeners: 167,890
4. Kent
Listeners: 145,678
5. Robyn
Listeners: 134,567
$ lastfm tag info "synthwave"
🏷️ Tag: synthwave
📊 Statistics:
Reach: 234,567
Total Uses: 1,234,567
📝 Description:
Synthwave is a genre of electronic music influenced
by 1980s film soundtracks and video games. Using
synthesizers, the genre evokes nostalgia while
creating a retro-futuristic atmosphere.
🔗 Wiki: https://www.last.fm/tag/synthwave
$ lastfm my profile
👤 Your Profile
john_doe
🎵 Total Scrobbles: 45,678
📅 Member Since: May 15, 2015
🌍 Country: United States
📊 This Week:
Artists: 23
Albums: 18
Tracks: 156
🔗 Profile: https://www.last.fm/user/john_doe
$ lastfm config show
⚙️ Configuration
📁 Config file: ~/.config/lastfm/config.json
API Settings:
API Key: ••••••••••••••••••••••••••••••••
Username: john_doe
Display Settings:
Default Limit: 20
Date Format: relative
Output Format: formatted
To update: lastfm config set <key> <value>
Clean, modern Swift API with async/await
// Search for artists
let artists = try await client.artist.search(
"Daft Punk",
limit: 20
)
// Get similar artists
let similar = try await client.artist.getSimilar(
"Daft Punk",
limit: 10
)
// Search albums
let albums = try await client.album.search(
"Random Access Memories"
)
// Get user profile
let user = try await client.user.getInfo("rj")
// Recent tracks
let recent = try await client.user.getRecentTracks(
"rj",
from: Date().addingTimeInterval(-86400),
extended: true
)
// Top artists
let topArtists = try await client.user.getTopArtists(
"rj",
period: .overall,
limit: 50
)
// Global charts
let topTracks = try await client.chart.getTopTracks(
page: 1,
limit: 100
)
// Country-specific
let ukArtists = try await client.geo.getTopArtists(
country: "United Kingdom",
limit: 50
)
// Top tags
let tags = try await client.chart.getTopTags()