YePpHa / YouTubeCenter

YouTube Center is a userscript designed to expand the functionality of YouTube. It includes the ability to download the video you're watching, auto selecting your preferred video quality and much more.
MIT License
2.89k stars 522 forks source link

"https://gdata.youtube.com/feeds/api/videos/undefined" console spam high cpu #449

Open vzjrz opened 10 years ago

vzjrz commented 10 years ago

New vanilla firefox profile 1.15 greasemonkey 289 youtubecenter dev build

05:26:42.144 GET https://gdata.youtube.com/feeds/api/videos/undefined [HTTP/1.1 400 Bad Request 1184ms]
05:26:41.785 "[Player modifyConfig] => watch" YouTubeCenter.user.js:2425
05:26:41.785 "[Player Type] Flash" YouTubeCenter.user.js:2425
05:26:41.786 "[Player Ratio] Player ratio set to 1.7777777777777777" YouTubeCenter.user.js:2425
05:26:41.786 "Keeping the aspect" YouTubeCenter.user.js:2425
05:26:41.786 "[Playlist] Disabled" YouTubeCenter.user.js:2425
05:26:41.787 "[Player Update] Checking if player exist!" YouTubeCenter.user.js:2425
05:26:42.474 "[Player modifyConfig] => watch" YouTubeCenter.user.js:2425
05:26:42.475 "[Player Type] Flash" YouTubeCenter.user.js:2425
05:26:42.476 "[Player Ratio] Player ratio set to 1.7777777777777777" YouTubeCenter.user.js:2425
05:26:42.476 "Keeping the aspect" YouTubeCenter.user.js:2425
05:26:42.476 "[Playlist] Disabled" YouTubeCenter.user.js:2425
05:26:42.476 "[Player Update] Checking if player exist!" YouTubeCenter.user.js:2425
05:26:43.054 "[Player modifyConfig] => watch" YouTubeCenter.user.js:2425
05:26:43.054 "[Player Type] Flash" YouTubeCenter.user.js:2425
05:26:43.055 "[Player Ratio] Player ratio set to 1.7777777777777777" YouTubeCenter.user.js:2425
05:26:43.055 "Keeping the aspect" YouTubeCenter.user.js:2425
05:26:43.055 "[Playlist] Disabled" YouTubeCenter.user.js:2425
05:26:43.056 "[Player Update] Checking if player exist!" YouTubeCenter.user.js:2425
05:26:43.266 "[Player modifyConfig] => watch" YouTubeCenter.user.js:2425
05:26:43.266 "[Player Type] Flash" YouTubeCenter.user.js:2425
05:26:43.267 "[Player Ratio] Player ratio set to 1.7777777777777777" YouTubeCenter.user.js:2425
05:26:43.268 "Keeping the aspect" YouTubeCenter.user.js:2425
05:26:43.268 "[Playlist] Disabled" YouTubeCenter.user.js:2425
05:26:43.268 "[Player Update] Checking if player exist!"

CPU: https://i.imgur.com/eWSUIUn.png

Settings: http://pastebin.com/WS3iU9U8

Choonce commented 10 years ago

I've noticed there's a really long delay that will freeze my Firefox 31 when I open a new youtube video, this only happens in HTML 5 mode, could this be related?

mitisBlack commented 10 years ago

@Choonce i see the same delay on opera 21 with HTML 5 ... haven't looked at the logs yet

YePpHa commented 10 years ago

It seems like YouTube Center thinks that the player is flash, but it's actually HTML5. So it tries to find the flash player, but the problem is that it doesn't exist.

I will see if I can find out what went wrong in the detection of the HTML5 player.

Sophira commented 10 years ago

I have a similar issue (using Developer Build 298), which may or may not be related. (I deleted my previous comment as it was slightly inaccurate.)

In my case, I don't see console spam (sorry, I do; I was looking at the wrong console), but I do see a lot of repeated GET requests (about 8-10 a second) to https://gdata.youtube.com/feeds/api/videos/undefined?v=2 . Mostly they don't get answered because their connections are probably closed before the server can respond, but occasionally Google manages to send back a 400 error.

I always use Flash players (I dislike the HTML5 player), so I don't think it's an issue with HTML5 players only.

I use NoScript to block most JavaScript. I will test to see if this causes the issue and report back.

If you need any more info, let me know.

Sophira commented 10 years ago

I have tested with a combination of different NoScript and AdBlock settings and they appear to not make a difference. The issue also appears to be intermittent; config.args.video_id is sometimes populated and sometimes not. For example, on various refreshes of https://www.youtube.com/watch?v=VLBXJvxe9QU , I will sometimes see a single GET request to https://gdata.youtube.com/feeds/api/videos/VLBXJvxe9QU?v=2 , and sometimes repeated GET requests to https://gdata.youtube.com/feeds/api/videos/undefined?v=2 . It is always one or the other, however.

As a coder, my gut instinct is that there's a race condition populating config.args relying on some element to be loaded before the first check. I suspect that sometimes this element is loaded before the population, and sometimes after.

Doing some debugging.

Sophira commented 10 years ago

I've done a few tests and I believe that the problem stems from the Intercom system. Specifically, whenever the failure occurs, these lines appear in the log right next to each other:

[14:17:09.419] [SaveSettings] Ordering other tabs to load the new settings. [14:17:09.682] [Intercom] Received order to loadSettings!

I believe the Intercom is mistakenly ordering itself to load new settings. Somehow, this makes everything else start to go wrong.

I'll try to figure out how, but can't promise anything.