【发布时间】:2020-06-10 12:16:33
【问题描述】:
我将 youtube api v3 用于研究目的,我可以获得喜欢、不喜欢、cmets 和更多统计信息,但我想根据地区或国家/地区获得喜欢和观看次数。例如,我想知道任何特定视频从不同地区获得了多少喜欢和观看。 youtube_api v3 是否提供此选项。
def get_channel_videos(channel_id):
res = youtube.channels().list(id=channel_id,
part='contentDetails').execute()
playlist_id = res['items'][0]['contentDetails']
['relatedPlaylists']['uploads']
videos = []
next_page_token = None
while True:
res = youtube.playlistItems().list(playlistId=playlist_id,
part='snippet',
maxResults=50,
pageToken=next_page_token).execute()
videos += res['items']
next_page_token = res.get('nextPageToken')
if next_page_token is None:
break
return videos
videos = get_channel_videos('UCqRTj-Nu_8to3jIBlXptOtA')
【问题讨论】: