Title: | Download 'Scrobbles' from 'Last.fm' |
---|---|
Description: | 'Last.fm'<https://www.last.fm> is a music platform focussed on building a detailed profile of a users listening habits. It does this by 'scrobbling' (recording) every track you listen to on other platforms ('spotify', 'youtube', 'soundcloud' etc) and transferring them to your 'Last.fm' database. This allows 'Last.fm' to act as a complete record of your entire listening history. 'scrobbler' provides helper functions to download and analyse your listening history in R. |
Authors: | Conor Neilson |
Maintainer: | Conor Neilson <[email protected]> |
License: | GPL-3 |
Version: | 1.0.3.9000 |
Built: | 2024-11-17 04:10:13 UTC |
Source: | https://github.com/condwanaland/scrobbler |
download_scrobbles
download_scrobbles( username = get_lastfm_credentials("username"), api_key = get_lastfm_credentials("key"), max_per_page = 1000, max_pages = NULL )
download_scrobbles( username = get_lastfm_credentials("username"), api_key = get_lastfm_credentials("key"), max_per_page = 1000, max_pages = NULL )
username |
Your last.fm account username |
api_key |
Your last.fm account api key |
max_per_page |
Controls the maximum number of songs on each page of the API. A lower number here will lead to a higher number total pages. Defaults to 1000. Mainly useful for testing. |
max_pages |
Controls the maximum number of pages to return from the API. By default it will fetch everything. Mainly useful for testing. |
A dataframe of songs and associated metadata
## Not run: download_scrobbles(username = "your_username", api_key = "your_api_key") ## End(Not run)
## Not run: download_scrobbles(username = "your_username", api_key = "your_api_key") ## End(Not run)
get_last_timestamp
get_last_timestamp(scrobbles_df, timestamp_column)
get_last_timestamp(scrobbles_df, timestamp_column)
scrobbles_df |
A dataframe output of 'download_scrobbles' |
timestamp_column |
The column in 'scrobbles_df' that corresponds to the 'date_unix' column |
Numeric vector
## Not run: get_last_timestamp(mydata, 'date_unix') ## End(Not run)
## Not run: get_last_timestamp(mydata, 'date_unix') ## End(Not run)
get_lastfm_credentials
get_lastfm_credentials(env)
get_lastfm_credentials(env)
env |
One of 'username' or 'key', to return the username or key environment variable respectively |
Character string
## Not run: get_lastfm_credentials(env = 'username') get_lastfm_credentials(env = 'key') ## End(Not run)
## Not run: get_lastfm_credentials(env = 'username') get_lastfm_credentials(env = 'key') ## End(Not run)
Companion function to 'download_scrobbles'. Only downloads the scrobbles that have been stored since you ran 'download_scrobbles'.
update_scrobbles( data, timestamp_column, username = get_lastfm_credentials("username"), api_key = get_lastfm_credentials("key"), max_per_page = 1000 )
update_scrobbles( data, timestamp_column, username = get_lastfm_credentials("username"), api_key = get_lastfm_credentials("key"), max_per_page = 1000 )
data |
A dataframe outputted by 'download_scrobbles' |
timestamp_column |
The 'date_unix' column in your dataframe |
username |
Last.fm API username |
api_key |
Last.fm API key |
max_per_page |
Controls the maximum number of songs on each page of the API. A lower number here will lead to a higher number total pages. Defaults to 1000. Mainly useful for testing. description |
A dataframe
## Not run: mydat <- download_scrobbles(username = "your_username", api_key = "your_api_key") update_dat <- update_scrobbles(mydat, "date_unix", username = "your_username", api_key = "your_api_key") ## End(Not run)
## Not run: mydat <- download_scrobbles(username = "your_username", api_key = "your_api_key") update_dat <- update_scrobbles(mydat, "date_unix", username = "your_username", api_key = "your_api_key") ## End(Not run)