0

I want to download, using PHP code, the complete list of my videos (over 2000) so that I can create a database of Title, Scheduled Publish Date (not upload date), URL, Thumbnail (smallest one), and Description. I need an example or directions on the APIs I should use and how to use them.

sasakigs
  • 1
  • 1

2 Answers2

0

The Youtube API method for listing all your videos is Videos.list. Check the Youtube PHP samples.

Here's a snippet using the videos.list call:

# Call the videos.list method to retrieve location details for each video.
    $videosResponse = $youtube->videos->listVideos('snippet, recordingDetails', array(
    'id' => $videoIds,
    ));
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
  • Thanks for responding. When I looked at that API, it seemed that I couldn't get all of my videos without specifying each video ID. Is there are 'filter' specification that lets me get all of my videos? Or, is there another API for that? – sasakigs May 22 '17 at 17:08
0

Do you have an API key? If not get the Youtube Data API from Google Developers API Library.

It will ask you to start a new "Project" to get a key.

With the API key you can retrieve channel uploads using these PHP scripts: https://developers.google.com/youtube/v3/code_samples/php#retrieve_my_uploads

They limit you to only 50 items per query, however. Then you need to pull the info again, sending the nextPagetoken you got the first time.

This post has a complete PHP script looping with nextPage tokens.

Is there a reason it has to be in PHP? If you just need the videos list I've uploaded a CGI form that gets all of the data in a list: Get all videos from a channel.

Bman70
  • 743
  • 5
  • 11
  • Thanks for the response. I do have a key. I also saw the issue of 50 item limits, and I was hoping that there would be a way around it. Looks like I will have to take a closer look at the example you pointed to. As for PHP - the reason is that I was hoping to run a CRON that would update the database each day as new videos were published to my channel. This database would allow viewers to find videos using search functions that YouTube doesn't have. I've got 2000+ videos. – sasakigs May 24 '17 at 15:59