https://github.com/hp0404/lastfm-to-sqlite
Scrape LAST.FM user's playlists to SQLite
https://github.com/hp0404/lastfm-to-sqlite
lastfm lastfm-api sqlite-utils
Last synced: 11 months ago
JSON representation
Scrape LAST.FM user's playlists to SQLite
- Host: GitHub
- URL: https://github.com/hp0404/lastfm-to-sqlite
- Owner: hp0404
- License: apache-2.0
- Created: 2020-10-25T09:18:42.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-13T11:59:50.000Z (almost 5 years ago)
- Last Synced: 2025-07-23T03:26:44.684Z (11 months ago)
- Topics: lastfm, lastfm-api, sqlite-utils
- Language: Python
- Homepage:
- Size: 54.7 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lastfm
[](https://github.com/hp0404/lastfm/blob/main/LICENSE)
[](https://codecov.io/gh/hp0404/lastfm-to-sqlite)
[](https://lastfm.readthedocs.io/en/latest/?badge=latest)
- Scrape [LAST.FM](https://www.last.fm/) user's playlists to SQLite.
- Docs: https://lastfm.readthedocs.io/en/latest/
## Usage
pip install lastfm-to-sqlite
Now run CLI:
lastfm export 244ec3b62b2501514191234eed07c75d lastfm_dump.db --user Way4Music
That will use (or create) a SQLite database called `lastfm_dump.db` and a table called `playlist` to export user's entire playlist.
To scrape specific dates, use `--start_date` and `--end_date`:
lastfm export 244ec3b62b2501514191234eed07c75 lastfm_dump.db --user way4music --start_date 2021-08-21 --end_date 2021-09-01
Python-based API works like this:
from lastfm import LastFM
# specific date, ommit start_date and end_date to download all tracks
api = LastFM(
api="244ec3b62b2501514191234eed07c75d",
username="way4music",
start_date="2021-08-21",
end_date="2021-09-01"
)
data = api.fetch()
song = next(data)
print(song)
container = []
for item in data:
container.append(item)