Remove support for username argument in get_user_videos.
Just get their id first with get_user_id.
This commit is contained in:
parent
e1eb53a114
commit
215a46591e
1 changed files with 2 additions and 7 deletions
|
@ -97,13 +97,8 @@ class Youtube:
|
||||||
user = self.youtube.channels().list(part='contentDetails', id=uid).execute()
|
user = self.youtube.channels().list(part='contentDetails', id=uid).execute()
|
||||||
return user['items'][0]['contentDetails']['relatedPlaylists']['uploads']
|
return user['items'][0]['contentDetails']['relatedPlaylists']['uploads']
|
||||||
|
|
||||||
def get_user_videos(self, username=None, uid=None):
|
def get_user_videos(self, uid):
|
||||||
if username:
|
yield from self.get_playlist_videos(self.get_user_uploads_playlist_id(uid))
|
||||||
user = self.youtube.channels().list(part='contentDetails', forUsername=username).execute()
|
|
||||||
else:
|
|
||||||
user = self.youtube.channels().list(part='contentDetails', id=uid).execute()
|
|
||||||
upload_playlist_id = user['items'][0]['contentDetails']['relatedPlaylists']['uploads']
|
|
||||||
yield from self.get_playlist_videos(upload_playlist_id)
|
|
||||||
|
|
||||||
def get_related_videos(self, video_id, count=50):
|
def get_related_videos(self, video_id, count=50):
|
||||||
if isinstance(video_id, Video):
|
if isinstance(video_id, Video):
|
||||||
|
|
Loading…
Reference in a new issue