Registry / communication / spotify2ytmusicv2

spotify2ytmusicv2

JSON →
library0.2.2pypypiunverified

A tool to copy Spotify playlists to YouTube Music (YTMusic). Currently at version 0.2.2, released on 2025-04-20. Release cadence is irregular; still in early development.

pip install spotify2ytmusicv2
INSTALL
IMPORT
SIG · SPOTIFY2YTMUSICV2
S
spotify2ytmusicv2
communicationpythonv0.2.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Spotify2YTMusic
from spotify2ytmusicv2.backend import Spotify2YTMusic
from spotify2ytmusicv2 import Spotify2YTMusic

Authenticate and copy a Spotify playlist to YouTube Music. Obtain Spotify API credentials from Spotify Developer Dashboard, and YTMusic headers from browser dev tools after logging into music.youtube.com.

from spotify2ytmusicv2 import Spotify2YTMusic import os client = Spotify2YTMusic( spotify_client_id=os.environ.get('SPOTIFY_CLIENT_ID', ''), spotify_client_secret=os.environ.get('SPOTIFY_CLIENT_SECRET', ''), ytmusic_headers_raw=os.environ.get('YT_MUSIC_HEADERS', '{}') ) playlist_id = 'your_spotify_playlist_id' client.copy_playlist(playlist_id, public=True)
Debug
Known issues
gotchaThe YTMusic headers must be passed as a raw JSON string in the environment variable YT_MUSIC_HEADERS. Do not use a dictionary or file; the library expects a string.
fix
Export the headers JSON as a string: export YT_MUSIC_HEADERS='{"User-Agent":"...","Cookie":"..."}'
affects: All
breakingIn version 0.2.0, the method `copy_playlist` was renamed from `transfer_playlist`. Calling `transfer_playlist` will raise an AttributeError.
fix
Use `client.copy_playlist(...)` instead of `client.transfer_playlist(...)`.
affects: >=0.2.0
gotchaThe library expects Spotify playlist ID (not URL). Passing a full Spotify URL will fail silently or raise an error.
fix
Extract the ID from the URL (e.g., '3s9t1vD1d0c2a6b8f0e4a' from 'open.spotify.com/playlist/...').
affects: All
Upgrade
Version history
0.2.2latest on PyPI · released Jan 14, 2025
Audit
Dependencies
spotipyrequiredRequired for Spotify API interaction
ytmusicapirequiredRequired for YouTube Music API interaction
Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources
spotify2ytmusicv2 — pip install spotify2ytmusicv2 · libregistry