Last.fm URL Scrobbler
Scrobble tracks to Last.fm directly from any Last.fm URL (track, album, artist, or tag).
Features
- URL Parsing: Works with tracks, full albums, artist top tracks, user pages, and tag charts.
- Custom Timestamps: Set custom start dates and times in the past or future (e.g.,
"2024-05-20 14:30"). - Dry Run: Preview fetched tracklists and calculated timestamps without submitting scrobbles.
Prerequisites
- Python 3.8+
- A Last.fm account
1. Installation
pip install git+https://github.com/1orelai/lastfm-url-scrobbler.git
This installs two commands, lastfm-url-scrobbler and get-session-key, onto your PATH.
2. Set Up Last.fm API Credentials
- Create a free API application on the Last.fm API account page.
- Log in and submit the form (e.g., Application Name:
URLScrobbler). - Copy your API Key and Shared Secret.
Export them in your terminal:
export LASTFM_API_KEY="your_api_key_here"
export LASTFM_API_SECRET="your_shared_secret_here"
3. Authenticate (One-Time)
Generate a write-enabled session key:
get-session-key
- This opens an authorization URL in your browser.
- Click Yes, Allow Access.
- Return to the terminal and press Enter.
- Copy the printed session key and export it:
export LASTFM_SESSION_KEY="your_retrieved_session_key"
Tip: Add all three
exportcommands to your~/.zshrcor~/.bashrcso they persist across terminal sessions.
4. Usage
lastfm-url-scrobbler "https://www.last.fm/music/Magazine/Real+Life"
Options
| Flag | Description | Default |
|---|---|---|
--dry-run |
Preview tracks and timestamps without submitting scrobbles | False |
--gap SECONDS |
Gap between tracks, in seconds | 5 |
--start DATE |
Start time, e.g. "2024-05-20 14:30" or "2024-05-20" |
Current time |
Examples
Scrobble a single track:
lastfm-url-scrobbler "https://www.last.fm/music/The+Beatles/_/Blackbird"
Scrobble an artist's top tracks:
lastfm-url-scrobbler "https://www.last.fm/music/Joni+Mitchell/+tracks"
Scrobble an album with a custom start date:
lastfm-url-scrobbler "https://www.last.fm/music/The+Stooges/Fun+House" --start "2024-05-20 14:30"
Preview without sending (dry run):
lastfm-url-scrobbler "https://www.last.fm/tag/classic+rock" --dry-run
Development
To work on the tool locally instead of installing from GitHub:
git clone https://github.com/1orelai/lastfm-url-scrobbler.git
cd lastfm-url-scrobbler
pip install -e .
The -e (editable) install links the commands to your working copy, so changes take effect immediately.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lastfm_url_scrobbler-0.1.0.tar.gz.
File metadata
- Download URL: lastfm_url_scrobbler-0.1.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e059e8bde521c56e8b1ed7e53dc93165af8561fa3a8010c2d75c13183a4253b0
|
|
| MD5 |
1c2f770e8b993772bf392152b6fdc9bc
|
|
| BLAKE2b-256 |
abd658a139218a5a7b86a963cdca4b05af8611d701a1666f24687bba3d2dd5ce
|
File details
Details for the file lastfm_url_scrobbler-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lastfm_url_scrobbler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cd3bc7d4f41b34c3918a0a050860a5c6aad316555ba6de6cebb1ec3ceb014ac
|
|
| MD5 |
e6de4ac9289c4192ddf79d549f8b60c8
|
|
| BLAKE2b-256 |
5598a6fd880d9521a8602b092cec32224094cd78908ffb1df5c68ab208c8f46e
|