Reputation: 488
I want to fetch all videos of YouTube. Not from any particular channel but all existing videos from YouTube. How to use the API to grab all?
Upvotes: 0
Views: 474
Reputation: 773
Mr. Rebot's suggestion could be modified to:
Find a random video with the search.list function.
Get the channel ID from the JSON response:
"kind": "youtube#video",
"videoId": "nSDgHBxUbVQ"
},
"snippet": {
"publishedAt": "2015-05-10T00:40:11.000Z",
"channelId": "UC0C-w0YjGpqDXGB8IHb662A",
"title": "Ed Sheeran - Photograph (Official Music Video)",
With the channel ID, gather all uploads from that channel:
https://stackoverflow.com/a/22616491/7922428
Fetch another random channel, compare to previous channel IDs to make sure it's not a duplicate, repeat process.
Very ambitious project. One report in 2015 said 1.2 billion videos were online. One search.list request uses 100 units of a daily 1 million allowed (unless you pay for more). So you could theoretically process 10,000 videos per day. So in 120k days (328 years) you could have all the videos. Max 50 results per call would allow you to get .5 million videos per day.. a mere 6.5 years.
Upvotes: 2
Reputation: 6791
You could use search.list
method and leave the q
parameter blank to get random videos. But I agree with @Ashkar, use q
parameter to get specific list of videos.
You can always try the API explorer to test the search.list
method.
Hope this helps.
Upvotes: 0