2012-04-02 119 views
-1

如何檢索特定Youtube用戶上傳的視頻數量?我一直在尋找答案,但似乎無法找到答案。如何檢索特定Youtube用戶上傳的視頻數量?

使用你從這個

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

得到的信息,我可以看到的共有50部影片的限制。但我想得到一個總數。有人會知道我怎麼能得到這個?

回答

2

您可以從這裏得到的視頻計數:

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

然後你就可以很容易地使用JavaScript或任何挑出你想要的。

1

使用此代碼:

<?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'}; 
?>