VideoHive

YouTube PHP API - How to retrieve a user videos ?

1422 posts
  • Microlancer Beta Tester
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 000 and 250 000 dollars
+2 more
ZoomIt says

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!

2333 posts
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Elite Author
  • Contributed a Blog Post
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Has been a member for 4-5 years
+8 more
dtbaker moderator says

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 .

61 posts
  • Bought between 1 and 9 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 2-3 years
  • Most Wanted Bounty Winner
  • Referred between 50 and 99 users
  • Sold between 100 000 and 250 000 dollars
yougapi says

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) ;)

1422 posts
  • Microlancer Beta Tester
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 000 and 250 000 dollars
+2 more
ZoomIt says

Wow, thanks guys, just what I needed

1422 posts
  • Microlancer Beta Tester
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 000 and 250 000 dollars
+2 more
ZoomIt says

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

by
by
by
by
by