YouTube是否通过api公开了它的艺术家图表,或者有没有办法使用youtube api获取图表数据?
答案 0 :(得分:1)
我不认为使用官方Youtube API是可能的,如果我们查看https://artists.youtube.com/charts/videos,它会使用具有特定API密钥的YouTube内部API(InnerTube)(已注册使用2017-06-18 11:18:55 +0000 amount 231.0
2018-06-16 09:49:53 +0000 amount 33.0
2018-06-16 11:06:34 +0000 amount 55.0
2018-06-16 11:44:05 +0000 amount 44.0
2018-06-16 11:44:28 +0000 amount 77.0
2018-06-16 11:45:50 +0000 amount 33.0
2019-06-16 14:48:03 +0000 amount 55.0
API开发者无法使用)
当然这只是一个黑客只是FYI
API密钥已youtubei
配置为referer,添加自定义标头:https://artists.youtube.com
使其有效:
x-referer:https://artists.youtube.com
如果不起作用,请从https://artists.youtube.com
的网络日志中获取API密钥在curl -H 'Content-Type: application/json' \
-H "x-referer:https://artists.youtube.com" \
"https://content.googleapis.com/youtubei/v1/browse?alt=json&key=AIzaSyCzEW7JUJdSql0-2V4tHUb6laYm4iAE_dM" \
-d '{
"context": {
"client": {
"clientName": "WEB_MUSIC_ANALYTICS",
"clientVersion": "0.2",
"theme": "MUSIC",
"hl": "en",
"gl": "FR",
"experimentIds": []
},
"capabilities": {
},
"request": {
"internalExperimentFlags": []
}
},
"browseId": "FEmusic_analytics",
"query": "chart_params_type=WEEK&perspective=CHART&flags=viral_video_chart&selected_chart=VIRAL_VIDEOS"
}'
字段中,您可以修改query
参数:
所有视频:
selected_chart
病毒视频图表:
selected_chart=VIDEOS
艺术家:
selected_chart=VIRAL_VIDEOS
曲目:
selected_chart=ARTISTS