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?
-
All videos? You should use some conditions right? like all videos with the tag x or something – Ashkar May 27 '17 at 10:28
-
No I mean to get all videos availabe on youtube – Pratik bhatt May 27 '17 at 10:41
2 Answers
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/7922428Fetch 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.
-
-
Not to mention the reported 300k new videos uploaded daily (https://www.quora.com/How-many-videos-are-uploaded-on-YouTube-every-day). – Bman70 May 28 '17 at 01:38
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.

- 6,703
- 2
- 16
- 91