Want to listen to whatever your favourite BBC radio station is playing, without all the conversational interludes?
This tool grabs the current playlist for a given BBC radio station, and uses these songs to create or update a Spotify playlist of your choice.
It works for: BBC Radio 1, BBC Radio 1 Xtra, BBC Radio 2, BBC Radio 6 Music, and BBC Asian Network.
- Nix
- Installable here: https://nixos.org/download.
- Ensure nix-command and flakes are enabled. Instructions here: https://nixos.wiki/wiki/Flakes.
- A Spotify account
- Enter a temporary nix shell with
bbc-to-spotifyinstalled:
nix shell github:archie-judd/bbc-to-spotify- Install imperatively:
nix profile install github:archie-judd/bbc-to-spotify- Install declaratively with a flake:
Check install was successful by running the following command:
bbc-to-spotify --versionYou need to create a Spotify app to generate client credentials that will be required for authorizing the CLI.
You can follow the steps here: https://developer.spotify.com/documentation/web-api/concepts/apps.
When asked for a redirect URI, it is recommended to use the following value, however you may use a different one if you would like.
http://localhost:8080/bbc-to-spotify
This process will generate a refresh token, and optionally store it with your client credentials in your home folder for future authentication.
Start the authorization helper by running:
bbc-to-spotify authorizeSee Authorization for help on the authorize command.
You will be prompted for your client ID and client secret. You can copy them from your app's page.
You will then be taken through the steps to generate a refresh token, and asked if your credentials may be stored for future authentication.
See I don't want to store my credentials. Can I still use the CLI? if you want to use the CLI without storing your credentials.
CLI commands take the following format.
bbc-to-spotify <command> [arguments]
Run bbc-to-spotify <command> -h for information on a specific command.
The available commands are: authorize, create-playlist and update-playlist.
authorize runs the authorization process to generate credentials that will be needed to run the create-playlist and update-playlist commands.
bbc-to-spotify authorize [options]
Options
--redirect-uri <value> (string):
Redirect URI to use during authorization. Default value is
http://localhost:8080/bbc-to-spotify.
--verbose, -v (flag):
Increase the logging verbosity logging (
-vvto increase further).
--quiet, -q (flag):
Decrease the verbosity of logging (
--log-file <filepath> (string):
Write logs to this file. Suppresses logging in stdout.
create-playlist is used to create a new Spotify playlist with songs from a BBC radio station's current playlist.
bbc-to-spotify create-playlist <name> <source> [options]
Required arguments
name (string):
The name of the playlist to be created.
source (string):
The BBC Radio station whose current playlist should be added to the Spotify playlist.
Possible values:
radio-1
radio-1-xtra
radio-2
radio-6
bbc-asian-network
Options
--dry-run -n (flag):
Run the command but do not create the destination playlist.
--private, -p (flag):
Make the playlist private rather than public.
--desc <description> (string):
The description to add to the destination playlist.
--verbose, -v (flag):
Increase logging verbosity (
-vvto increase further).
--quiet, -q (flag):
Decrease logging verbosity (
--log-file <filepath> (string):
Write logs to this file. Suppresses logging in stdout.
update-playlist is used to update an existing Spotify playlist with songs from a BBC radio station's current playlist.
bbc-to-spotify update-playlist <playlist-id> <source> [options]
Required arguments
playlist-id (string):
The ID of the Spotify playlist on which to add the BBC station's current playlist tracks.
source (string):
The BBC Radio station whose current playlist should be added to the Spotify playlist.
Possible values:
radio-1
radio-1-xtra
radio-2
radio-6
bbc-asian-network
Options
--dry-run -n (flag):
Run the command but do not update the destination playlist.
--no-dups -N (flag):
Only add tracks that are not already in the destination playlist.
--prune -p (flag):
Remove all duplicates and any tracks that are not in the source playlist.
--prepend -P (flag):
Add new tracks to the beginning of the playlist (default behaviour is to add them at the end).
--update-desc -u (flag):
Add a 'Last updated' timestamp to the destination playlist description.
--verbose, -v (flag):
Increase logging verbosity (
-vvto increase further).
--quiet, -q (flag):
Decrease logging verbosity (
--log-file <filepath> (string):
Write logs to this file. Suppresses logging in stdout.
The playlists ID should be printed out after successfully executing the create-playlist command.
Alternatively you can get a Spotify playlist ID by clicking ... on the playlist's page, and then clicking Copy link to playlist under the Share menu.
This will give you a full playlist link that looks like the following:
https://open.spotify.com/playlist/37i9dQZF1DWXRqgorJj26U?si=9f6A6U2jTk-njyZJ64rk3g
The playlist ID is the code after playlist/ and before ?si (37i9dQZF1DWXRqgorJj26U).
Yes. You can then authorize bbc-to-spotify by setting the following environment variables before use: SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET, SPOTIFY_REFRESH_TOKEN.
You can get a refresh token by running bbc-to-spotify authorize and pressing N when asked to store credentials.
The scopes modify-playlist-publicand modify-playlist-private are provided. See more about scopes here: https://developer.spotify.com/documentation/web-api/concepts/scopes.