How to get watched history of youtube user using Youtube Javascript API?

筅森魡賤 提交于 2019-12-03 04:35:17

问题


I am able to get search results, playlists of an user using Youtube Javascript API.

How can i get the watched history of an user using Youtube Javascript API???

Is there any Javascript API to get the Youtube watched history of an user??


回答1:


Here's the general procedure:

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}

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}

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.




回答2:


This no longer seems possible with the V3 API. The watchHistory playlist ID is now always set to 'HL'.



来源:https://stackoverflow.com/questions/30849284/how-to-get-watched-history-of-youtube-user-using-youtube-javascript-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!