File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313
1414def get_videos (channel_id ):
1515 api = pyyoutube .Api (api_key = API_KEY )
16- channel_res = api .get_channel_info (channel_id = channel_id )
16+ channel_info = api .get_channel_info (channel_id = channel_id )
1717
18- playlist_id = channel_res .items [0 ].contentDetails .relatedPlaylists .uploads
18+ playlist_id = channel_info .items [0 ].contentDetails .relatedPlaylists .uploads
1919
20- playlist_item_res = api .get_playlist_items (
21- playlist_id = playlist_id , count = 10 , limit = 6
22- )
20+ uploads_playlist_items = api .get_playlist_items (playlist_id = playlist_id , count = 10 , limit = 6 )
2321
2422 videos = []
25- for item in playlist_item_res .items :
23+ for item in uploads_playlist_items .items :
2624 video_id = item .contentDetails .videoId
27- video_res = api .get_video_by_id (video_id = video_id )
28- videos .extend (video_res .items )
25+ video = api .get_video_by_id (video_id = video_id )
26+ videos .extend (video .items )
2927 return videos
3028
3129
You can’t perform that action at this time.
0 commit comments