Skip to content

Commit d47da87

Browse files
committed
Readability changes
1 parent 232018d commit d47da87

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

examples/channel_videos.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@
1313

1414
def 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

0 commit comments

Comments
 (0)