How can I retrieve the number of videos uploaded by a specific Youtube user?

我怕爱的太早我们不能终老 提交于 2019-12-23 07:03:26

问题


How can I retrieve the number of videos uploaded by a specific Youtube user? I have been searching for the answer, but can't seem to find it.

Using the information you get from this

gdata.youtube.com/feeds/api/users/username/uploads

I can see a limit of 50 videos. But I would like to get a total count. Would anyone know how I can get this?


回答1:


You can get the video count from here:

https://gdata.youtube.com/feeds/api/users/USERNAME_HERE/uploads?v=2&alt=jsonc&max-results=0

And then you can easily use javascript or whatever to pick out what you want.




回答2:


Use this code:

<?php
$JSON = file_get_contents("https://gdata.youtube.com/feeds/api/users/YOUTUBE USERNAME/uploads?v=2&alt=jsonc&max-results=0");
$JSON_Data = json_decode($JSON);
$totalvideos = $JSON_Data->{'data'}->{'totalItems'};
?>


来源:https://stackoverflow.com/questions/9970501/how-can-i-retrieve-the-number-of-videos-uploaded-by-a-specific-youtube-user

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