piyx / youtubetospotify Goto Github PK
View Code? Open in Web Editor NEWA Script which adds all songs from youtube playlist to a new spotify playlist.
A Script which adds all songs from youtube playlist to a new spotify playlist.
'prompt_for_user_token' is deprecated.
error is:
You need to set your Spotify API credentials.
You can do this by setting environment variables like so:
export SPOTIPY_CLIENT_ID='your-spotify-client-id'
export SPOTIPY_CLIENT_SECRET='your-spotify-client-secret'
export SPOTIPY_REDIRECT_URI='your-app-redirect-url'
Get your credentials at
https://developer.spotify.com/my-applications
Traceback (most recent call last):
File "D:\Users\yitzh\Desktop\YoutubeToSpotify-master\main.py", line 29, in
main()
File "D:\Users\yitzh\Desktop\YoutubeToSpotify-master\main.py", line 10, in main
spotify_playlist_id = sp.create_playlist(spotify_playlist_name)
File "D:\Users\yitzh\Desktop\YoutubeToSpotify-master\spotify.py", line 48, in create_playlist
"Authorization": f"Bearer {self.spotify.token}"
File "D:\Users\yitzh\Desktop\YoutubeToSpotify-master\spotify.py", line 21, in token
return util.prompt_for_user_token(
File "D:\Users\yitzh\Desktop\YoutubeToSpotify-master\venv\lib\site-packages\spotipy\util.py", line 80, in prompt_for_user_token
raise spotipy.SpotifyException(550, -1, "no credentials set")
spotipy.exceptions.SpotifyException: http status: 550, code:-1 - no credentials set, reason: None
credentials were set in .env.sample
would appreciate any help!
Just tried adding my YouTube playlist to Spotify but the program kept crashing at a certain song.
Due to tracks not being found.
My Playlist ID: PLIC0u39_FdlMOtIwmwMNimn4r35Wy2Pc6
Traceback (most recent call last): File "C:\youtubetospotify-master\main.py", line 21, in <module> main() File "C:\youtubetospotify-master\main.py", line 14, in main song_uri = sp.get_song_uri(song.artist, song.title) File "C:\youtubetospotify-master\spotify.py", line 67, in get_song_uri items = results['tracks']['items'] KeyError: 'tracks'
Added try, except block inside get_song_uri function
PS C:\Users\Matheus\Documents\YoutubeToSpotify-master> python main.py
Traceback (most recent call last):
File "C:\Users\Matheus\Documents\YoutubeToSpotify-master\main.py", line 29, in <module>
main()
File "C:\Users\Matheus\Documents\YoutubeToSpotify-master\main.py", line 6, in main
yt = Youtube()
File "C:\Users\Matheus\Documents\YoutubeToSpotify-master\youtube.py", line 35, in __init__
self.youtube = build(
File "C:\Users\Matheus\AppData\Local\Programs\Python\Python310\lib\site-packages\googleapiclient\_helpers.py", line 134, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\Matheus\AppData\Local\Programs\Python\Python310\lib\site-packages\googleapiclient\discovery.py", line 278, in build
service = build_from_document(
File "C:\Users\Matheus\AppData\Local\Programs\Python\Python310\lib\site-packages\googleapiclient\_helpers.py", line 134, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\Matheus\AppData\Local\Programs\Python\Python310\lib\site-packages\googleapiclient\discovery.py", line 527, in build_from_document
credentials = _auth.default_credentials(
File "C:\Users\Matheus\AppData\Local\Programs\Python\Python310\lib\site-packages\googleapiclient\_auth.py", line 54, in default_credentials
credentials, _ = google.auth.default(scopes=scopes, quota_project_id=quota_project_id)
File "C:\Users\Matheus\AppData\Local\Programs\Python\Python310\lib\site-packages\google\auth\_default.py", line 488, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started
PS C:\Users\Matheus\Documents\YoutubeToSpotify-master>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.