1
votes

I am using youtube's iframe API to embed videos, one at a time, on a website that gets lists of videos from reddit.

Yesterday everything was working fine, however today I am getting "402 Payment Required" when the iframe makes a call to http://www.youtube.com/get_video_info[...], and the videos doesn't load. This happens every once in a while, it feels like some sort of throttling. I thought it may be related to some changes to the code I've done today, but I was getting the same errors when I reverted to yesterday's code.

I believe the GET requests originates from Youtube's HTML5 player, which is loaded in the iframe, after calling new YT.Player:

        player = new YT.Player(
        'player', {
            playerVars: {
            // 'controls': 0 // TODO: Hide controls.
            },
            videoId: vidid,
            events: {
            'onReady': onPlayerReady,
            'onStateChange': checkState
            }
        }

GET http://www.youtube.com/get_video_info?html5=1&video_id=bV3W1a_rY7k&eurl=http%3A%2F%2Flocalhost%2Fderp.html&el=embedded&hl=en_US&splay=1 Response: 402 Payment Required

You can see the example live here:

http://ozi.ca/#videos

3

3 Answers

2
votes

After googling for a bit I found a refernce to this problem here.

It seems that youtube has hijacked the 402 to mean "Due to high usage, youtube requires a CAPTCHA to be solved."

0
votes

I agree with Trent. I came across this problem when trying to get video info thru MPS Youtube and realized it was because I was connecting through a VPN, so google was getting a ton of requests from the same IP and required the Captcha. As soon as I turned off the VPN, I was able to get video info

0
votes

The resolve this problem, navigate your browser to www.youtube.com and solve the captcha that you see there. Once you do that, you will no longer see the error.