1

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

4

3 回答 3

2

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."

于 2013-01-01T02:28:44.370 回答
0

我同意特伦特。我在尝试通过 MPS Youtube 获取视频信息时遇到了这个问题,并意识到这是因为我是通过 VPN 连接的,所以谷歌从同一个 IP 收到大量请求并需要验证码。关闭VPN后,我就可以获取视频信息

于 2015-01-03T17:18:40.030 回答
0

解决此问题,将您的浏览器导航到 www.youtube.com 并解决您在那里看到的验证码。一旦你这样做,你将不再看到错误。

于 2015-07-02T22:23:38.823 回答