YouTube error HTTP 429 - Too Many Requests

user3455531 picture user3455531 · Mar 7, 2015 · Viewed 7.6k times · Source

I have some php code that fetches a youtube link and then gets its thumbnail. For that I am using this:

$str = file_get_contents(youtubelink);

But I am getting this error sometimes:

Warning: file_get_contents(https://www.youtube.com/watch?v=urA28s-OGW0):     failed to open stream: HTTP request failed! HTTP/1.0 429 Too Many Requests in /home/mps/public_html/ajax/file.php on line 34

What is causing this error? How can I get rid of it? What's the limit I can access?

Answer

chris85 picture chris85 · Mar 7, 2015

They are probably blocking you. They have an API to use, https://developers.google.com/youtube/v3/.