Код: Выделить всё
## Function to get video details
def get_video_details(youtube, video_ids):
all_video_stats = []
for i in range(0, len(video_ids), 50):
request = youtube.videos().list(
part="snippet,statistics",
id=','.join(video_ids[i:i+50]))
response = request.execute()
for video in response['items']:
video_stats= dict(
Title = video['snippet']['title'],
Published_date = video['snippet']['publishedAt'],
Views = video['statistics']['viewCount'],
Likes = video['statistics']['likeCount'],
Comments = video['statistics']['commentCount']
)
all_video_stats.append(video_stats)
return all_video_stats
Подробнее здесь: https://stackoverflow.com/questions/788 ... outube-api