Package 'scrobbler'

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

Help Index


download_scrobbles

Description

download_scrobbles

Usage

download_scrobbles(
  username = get_lastfm_credentials("username"),
  api_key = get_lastfm_credentials("key"),
  max_per_page = 1000,
  max_pages = NULL
)

Arguments

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.

Value

A dataframe of songs and associated metadata

Examples

## Not run: 
download_scrobbles(username = "your_username", api_key = "your_api_key")

## End(Not run)

get_last_timestamp

Description

get_last_timestamp

Usage

get_last_timestamp(scrobbles_df, timestamp_column)

Arguments

scrobbles_df

A dataframe output of 'download_scrobbles'

timestamp_column

The column in 'scrobbles_df' that corresponds to the 'date_unix' column

Value

Numeric vector

Examples

## Not run: 
get_last_timestamp(mydata, 'date_unix')

## End(Not run)

get_lastfm_credentials

Description

get_lastfm_credentials

Usage

get_lastfm_credentials(env)

Arguments

env

One of 'username' or 'key', to return the username or key environment variable respectively

Value

Character string

Examples

## Not run: 
get_lastfm_credentials(env = 'username')
get_lastfm_credentials(env = 'key')

## End(Not run)

update_scrobbles

Description

Companion function to 'download_scrobbles'. Only downloads the scrobbles that have been stored since you ran 'download_scrobbles'.

Usage

update_scrobbles(
  data,
  timestamp_column,
  username = get_lastfm_credentials("username"),
  api_key = get_lastfm_credentials("key"),
  max_per_page = 1000
)

Arguments

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

Value

A dataframe

Examples

## 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)