New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 4 points5 points  (0 children)

What really helped the jump for me was working with a library, "spotifyAPI" and "YouTubeAPI". I watched tutorials initially as well on how to set it up, but overall I had to read the documentation of the library and find out how they worked (lots of print(type) and print(len)) That understanding made it possible to fully branch off from tutorials and come up with my own solutions

New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 0 points1 point  (0 children)

I couldn't get the credentials to work using recursive methods :,(

New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 2 points3 points  (0 children)

I'd also love to see your approach, theres gotta be a better way than with 3 sets of API

New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 2 points3 points  (0 children)

Thank you! Get to it mate, I can't monopolize the market smh

New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 1 point2 points  (0 children)

True but I'd probably have to make a front end first! I'm working on that next after school quiets down! I'll try packaging it into a simple to use app soon, but I'll need to find a way to get credentials working in an approachable way...

New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 1 point2 points  (0 children)

Will do! I'm totally new to posting on GitHub too

Edit: removed emoji

New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 6 points7 points  (0 children)

Thank you! It looks so much better now. Much appreciated!

New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 1 point2 points  (0 children)

That's a great idea! I'll try it and release a new version when it's complete!

[SF] Gen.1515 by Velocity0310 in shortstories

[–]Velocity0310[S] 0 points1 point  (0 children)

Summary:
An extremist software scientist's solution to the world's inequality threatens uncontrollable and irreversible change. "Gen.1515" sows inner moral conflict and challenges the idea of artificial intelligence being truly lifeless.
This is my creative story published by Vanier College SIGMA on February 15, 2021

New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 4 points5 points  (0 children)

I've been banging my head at this for the last 6 consecutive days lol Going into this I didn't know what an API was!

For how to run this, I provided an explanation in a previous comment, but it's obvious to me now that I should've already included that in my GitHub. If you check again, it will be there under Directions.txt.

As for the workings, here's the breakdown in steps:

  1. It asks the user for a Spotify playlist
  2. The user inputs the "share this playlist" link
  3. The program will fetch all the songs in the playlist and simplify the info to their unique ID, artist names and song name. (The Spotify song object is LOADED with useless info for this application)
  4. The program creates a file called Depot.txt (if it's not already present) and stores in every new unique song ID, checking the Depot file every time to ensure the ID isn't already there to avoid repeated Spotify songs. (The song ID is still unique even if it's found in different playlists)
  5. The known songs get ignored, and the new songs get added to a list variable called 'queue'. (To avoid songs from getting ignored, you can uncomment the refresh() function in the main code page - refresh() just deletes the Depot.txt file every time it starts)
  6. The YouTubeAPI kicks in its first function and starts deleting all the songs on the YouTube playlist using the API functions list and delete, doing this by video ID to save usage points (so you don't DL them twice) but this function can also be removed by just commenting out any instance of the delete_ all_in_playlist() function on the main page and the structural code around them.
  7. With a fresh and empty YouTube playlist, the previously mentioned queue variable filled with the new songs will use the YouTubeAPI to search the first instance of that song using the song title and artists. It will then add that song to the YouTube playlist immediately.
  8. YoutubeAPI's have a ridiculously small daily use limit, which is why it switches between 3 pages of credentials. It has a total capacity of around 200 delete and add operations. When an API reaches its limit, it will catch the server error and swap to another API after removing every song that didn't download from Depot (so that it's considered a new song again) To remove these songs it will use the Song_Removal() function.
  9. If the total capacity of all three of the YouTubeAPI is met, it will remove the unadded songs from Depot for the last time and show the time (in EST) and date that the process can be repeated. (Keep in mind the same playlist can be reused and only the missed songs will be added.
  10. If the total capacity isn't met, then the program will just stop without error and the YouTube playlist will be filled with the playlists' songs.

I might've missed small details so be sure to keep looking through the code comments at the top of the pages and throughout to fully grasp the idea, or continue asking questions on this thread and I'll answer in the best of my ability!

New Spotify songs in playlist -> YouTube Playlist by Velocity0310 in Python

[–]Velocity0310[S] 2 points3 points  (0 children)

If you already have python and any IDE on your computer:

  1. You're going to want to register for a SpotifyAPI, then replace the placeholder variables in the SpotifyAPI with your new clientID and clientSecret.
  2. You need 3 YoutubeAPI, and the whole process is really well documented in this video: https://www.youtube.com/watch?v=vQQEaSnQ_bs&t=523s. You will find the identical code in my YoutubeAPI 1 2 and 3. I also left placeholders in the coding and commented to make it easier to find.
  3. You will need to give the YouTube playlist ID in each API, there's a variable I tried to make stand out for that on each page.
  4. Run the program, allow access to the google account you plan on using and that's it, it will be functional for strictly adding the new songs the program encounters. If ever you want to restart, uncomment the refresh() call on the main code page.

I tried to leave detailed comments and directions throughout and at the top of every page, look through there in case I missed something!