Hi guys,
Has anybody used the YouTube API ? Is it easy to get all the videos of a user id ? Or all the videos from a playlist id ?
Thanks!
Hi guys,
Has anybody used the YouTube API ? Is it easy to get all the videos of a user id ? Or all the videos from a playlist id ?
Thanks!
According to my rather broken memory it is possible to get the latest 25 user videos from the RSS feed. I’m sure more is possible via the API.
You can get a user’s videos with this URL for ex (in this case it’s the whitehouse videos): http://gdata.youtube.com/feeds/api/users/whitehouse/uploads?v=2&alt=jsonc
The max results are 25, but you can get the rest by specifying the startIndex… You will notice this in the feed returned:
“totalItems”:1976,“startIndex”:1,“itemsPerPage”:25
The full documentation is here.
You can get an XML as well, but with the json result you can use the json_decode() function and have the feed returned converted to an array (easier to manipulate)
Wow, thanks guys, just what I needed
Ok, the playlist id thing was not answered and I found it by mistake -
http://gdata.youtube.com/feeds/api/playlists/08BACDB761A0C52A?alt=json&start-index=1&max-results=40
Just in case someone else searches for this