如何使用Youtube Javascript API获取youtube用户的观看历史记录? [英] How to get watched history of youtube user using Youtube Javascript API?
问题描述
我可以使用Youtube Javascript API获取用户的搜索结果,播放列表。
I am able to get search results, playlists of an user using Youtube Javascript API.
如何使用Youtube Javascript API获取用户观看的历史记录? ??
How can i get the watched history of an user using Youtube Javascript API???
是否有任何Javascript API来获取Youtube观看用户的历史记录?
Is there any Javascript API to get the Youtube watched history of an user??
推荐答案
以下是一般程序:
1)获取给定用户频道的观看历史记录播放列表(因为频道ID是关键字)获取用户信息)。请注意,这仅在用户通过oAuth2进行身份验证时才有效。
1) Get the "watch History" playlist of a given user's channel (as a channel ID is the key to getting user info). Note that this will ONLY work when a user is authenticated via oAuth2.
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&mine=true&key={YOUR_API_KEY}
通过该响应,应该有一个watchHistory播放列表...接受并调用playlistItems端点:
With that response, there should be a "watchHistory" playlist ... take it and call the playlistItems endpoint:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=HLTFxEo9ofKM2Siifxoy5V_A&key={YOUR_API_KEY}
很遗憾,很多用户现在通过API报告了观看记录播放列表中的错误:
Unfortunately, many users are reporting there's a bug in the watch history playlist through the API right now:
https://code.google.com/p/gdata-issues/issues/detail?id=4642
所以你的里程可能会有所不同。
So your mileage may vary.
这篇关于如何使用Youtube Javascript API获取youtube用户的观看历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!