Skip to content

Commit

Permalink
small doc string fixes, and adding more info in the readMe
Browse files Browse the repository at this point in the history
  • Loading branch information
TheComeUpCode committed Feb 13, 2020
1 parent 763c8d5 commit 16e1857
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
A simple script that takes your liked videos on Youtube, and generates a Spotify playlist based on the song in your liked videos.

## Table of Contents
* [Video](#Video)
* [Technologies](#Technologies)
* [Setup](#LocalSetup)
* [Video](#Video)
* [ToDo](#ToDo)

## Video
Check out the youtube video for a step by step walk through
[Youtube Video]

## Technologies
* [Youtube Data API v3]
* [Spotify Web API]
Expand All @@ -23,7 +27,7 @@ A simple script that takes your liked videos on Youtube, and generates a Spotify
* To Collect your Oauth Token, Visit this url here: [Get Oauth] and click the **Get Token** button
![alt text](images/spotify_token.png)

3) Enable Oauth For Youtube and and download the client_secrets.json
3) Enable Oauth For Youtube and download the client_secrets.json
* Ok this part is tricky but its worth it! Just follow the guide here [Set Up Youtube Oauth] !
If you are having issues check this out [Oauth Setup 2] and this one too [Oauth Setup 3]

Expand All @@ -32,14 +36,17 @@ A simple script that takes your liked videos on Youtube, and generates a Spotify
* you'll immediately see `Please visit this URL to authorize this application: <some long url>`
* click on it and log into your Google Account to collect the `authorization code`

## Video
Check out the youtube video about this project
[Youtube Video]

## ToDo
* Tests
* Add Error Handling

## Troubleshooting
* Sprtify Oauth token expires very quickly, If you come across a `KeyError` this could
be caused by an expired token. So just refer back to step 3 in local setup, and generate a new
token!


[Youtube Data API v3]: <https://developers.google.com/youtube/v3>
[Spotify Web API]: <https://developer.spotify.com/documentation/web-api/>
[Requests Library v 2.22.0]: <https://requests.readthedocs.io/en/master/>
Expand Down
21 changes: 11 additions & 10 deletions create_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_youtube_client(self):
return youtube_client

def get_liked_videos(self):
"""Grab Our Liked Videos & Creating A Dictionary Of Important Song Information"""
"""Grab Our Liked Videos & Create A Dictionary Of Important Song Information"""
request = self.youtube_client.videos().list(
part="snippet,contentDetails,statistics",
myRating="like"
Expand All @@ -53,16 +53,17 @@ def get_liked_videos(self):
song_name = video["track"]
artist = video["artist"]

# save all important info
self.all_song_info[video_title]={
"youtube_url": youtube_url,
"song_name": song_name,
"artist": artist,
if song_name is not None and artist is not None:
# save all important info and skip any missing song and artist
self.all_song_info[video_title] = {
"youtube_url": youtube_url,
"song_name": song_name,
"artist": artist,

# add the uri, easy to get song to put into playlist
"spotify_uri":self.get_spotify_uri(song_name,artist)
# add the uri, easy to get song to put into playlist
"spotify_uri":self.get_spotify_uri(song_name,artist)

}
}

def create_playlist(self):
"""Create A New Playlist"""
Expand Down Expand Up @@ -108,7 +109,7 @@ def get_spotify_uri(self, song_name, artist):
return uri

def add_song_to_playlist(self):
"""Add this song into the new Spotify playlist"""
"""Add all liked songs into a new Spotify playlist"""
# populate dictionary with our liked songs
self.get_liked_videos()

Expand Down

0 comments on commit 16e1857

Please sign in to comment.