|
|
@ -182,14 +182,24 @@ def initialize_upload(youtube, options): |
|
|
|
|
|
|
|
|
|
|
|
def get_playlist_by_name(youtube, playlist_name): |
|
|
|
response = youtube.playlists().list( |
|
|
|
part='snippet,id', |
|
|
|
mine=True, |
|
|
|
maxResults=50 |
|
|
|
).execute() |
|
|
|
for playlist in response["items"]: |
|
|
|
if playlist["snippet"]['title'] == playlist_name: |
|
|
|
return playlist['id'] |
|
|
|
pageToken = "" |
|
|
|
while pageToken != None: |
|
|
|
response = youtube.playlists().list( |
|
|
|
part='snippet,id', |
|
|
|
mine=True, |
|
|
|
maxResults=50, |
|
|
|
pageToken=pageToken |
|
|
|
).execute() |
|
|
|
|
|
|
|
for playlist in response["items"]: |
|
|
|
if playlist["snippet"]["title"] == playlist_name: |
|
|
|
return playlist["id"] |
|
|
|
|
|
|
|
# Ask next page if there are any |
|
|
|
if "nextPageToken" in response: |
|
|
|
pageToken = response["nextPageToken"] |
|
|
|
else: |
|
|
|
pageToken = None |
|
|
|
|
|
|
|
|
|
|
|
def create_playlist(youtube, playlist_name): |
|
|
|