我使用youtube api v3进行研究,我可以获得点赞、不喜欢、评论和更多统计数据,但我想根据地区或国家/地区获得点赞和浏览量。我想知道有多少点赞和观看任何特定的视频从不同的地区。此选项在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')
我认为youtube api没有提供这个功能,但你可以获得任何国家的趋势视频列表。如果有人有更好的建议,请告诉我们。
youtube.videos().list(part='snippet, recordingDetails, statistics',
regionCode='US', chart='mostPopular', maxResults=50)