News for hackers. Stuff that matters.
Re:YouTube artificially slows down video load times when usi... by andyjohnson0 on Monday November 20, 2023 @05:39AM (#38346048)
Trying to be charitable here: could this be a debug/test artefact that inadvertantly got into production?
Re:YouTube artificially slows down video load times when usi... by enlyth on Monday November 20, 2023 @05:50AM (#38346129)
Without studying the minified code I wouldn't assume malice just yet, this could be just an inexperienced developer trying to lazily fix some browser-specific bug, or something that accidentally made it to production like you say
Re:YouTube artificially slows down video load times when usi... by vanderZwan on Monday November 20, 2023 @05:59AM (#38346212)
You think they let inexperienced developers touch the YT code base without proper code review? Even if that were the case, which is an extremely charitable assumption, that itself would be malice in my opinion.
Re:YouTube artificially slows down video load times when usi... by enlyth on Monday November 20, 2023 @06:19AM (#38346396)
> You think they let inexperienced developers touch the YT code base

Uh, yes? We were all inexperienced at some point. Just the linked file is like 300k lines of unminified code, I doubt it's all written by PHDs with 20 years of experience

Re:YouTube artificially slows down video load times when usi... by xxs on Monday November 20, 2023 @06:27AM (#38346483)
Some would argue that owning a PhD degree does not necessarily guarantee half decent engineering skills.
Re:YouTube artificially slows down video load times when usi... by vanderZwan on Monday November 20, 2023 @07:57AM (#38347310)
It's the "without proper code review" part that I consider malice, not being inexperienced.
Re:YouTube artificially slows down video load times when usi... by sapiogram on Monday November 20, 2023 @06:15AM (#38346356)
> You think they let inexperienced developers touch the YT code base without proper code review?

Yes

Re:YouTube artificially slows down video load times when usi... by ric2b on Monday November 20, 2023 @11:23AM (#38350038)
YouTube is way too stable for that to be the case.
Re:YouTube artificially slows down video load times when usi... by londons_explore on Monday November 20, 2023 @06:08AM (#38346294)
lol

This reply is for everyone who has ever worked on the codebase...

Re:YouTube artificially slows down video load times when usi... by ozim on Monday November 20, 2023 @06:35AM (#38346552)
Should be: LOL LGTM
Re:YouTube artificially slows down video load times when usi... by asddubs on Monday November 20, 2023 @06:24AM (#38346440)
there is such a thing as overextending the benefit of the doubt, to the point that malicious actors will abuse it.
Re:YouTube artificially slows down video load times when usi... by xxs on Monday November 20, 2023 @06:24AM (#38346439)
As the saying goes: "we like naked girls, not naked sleep". Even the interns should know that, naked sleep is just bad - not fixing anything.
Re:YouTube artificially slows down video load times when usi... by kevincox on Monday November 20, 2023 @07:53AM (#38347274)
It could even just be a timeout as part of retry logic or similar. A lot of people seem to be saying that there is no reasonable reason to have a `sleep` in a production application. But there are many legitimate reasons to need to delay execution of some code for a while.
Re:YouTube artificially slows down video load times when usi... by neonsunset on Monday November 20, 2023 @06:39AM (#38346606)
Unlikely. Google has been breaking non-Chromium (or sometimes even just non-Google Chrome) browsers for years on YouTube and their other websites. It was especially egregious when MSFT was trying their own EdgeHTML/Trident-based Edge. Issues would go away by faking user-agent.
Re:YouTube artificially slows down video load times when usi... by thaumasiotes on Monday November 20, 2023 @07:18AM (#38346926)
> It was especially egregious when MSFT was trying their own EdgeHTML/Trident-based Edge. Issues would go away by faking user-agent.

Why is there more than one user-agent? Does somebody still expect to receive different content based on the user-agent, and furthermore expect that the difference will be beneficial to them?

What was Microsoft trying to achieve by sending a non-Chrome user-agent?

Re:YouTube artificially slows down video load times when usi... by kevincox on Monday November 20, 2023 @07:51AM (#38347253)
User agents are useful. However they tend to be abused much more often than effectively used

1. They are useful for working around bugs. You can match the user agent to work around the bugs on known-buggy browser versions. Ideally this would be a handful of specific matches (like Firefox versions 12-14). You can't do feature detection for many bugs because they may only trigger in very specific situations. Ideally this blacklist would only be confirmed entries and manually tested if the new versions have the same problem. (Unfortunately these often end up open-ended because testing each new release for a bug that isn't on the priority list is tedious.)

2. Diagnosing problems. Often times you see that some specific group of user-agents is hammering some API or fails to load a page. It is much easier to track down if this user agent is a precise identifier of the client for which your site doesn't work correctly.

3. Understanding users. For example if you see that a browser you have never heard of is a significant amount of traffic you may want to add it to your testing routine.

But yes, the abuse of if (/Chrome/.test(navigator.userAgent)) { mainCode() } else { untestedFallback() } is a major issue.

Re:YouTube artificially slows down video load times when usi... by thaumasiotes on Monday November 20, 2023 @07:53AM (#38347272)
Only option 1 is something that users, who are the people who decide what user-agent to send, might care about. And as you yourself point out, it doesn't happen.
Re:YouTube artificially slows down video load times when usi... by kevincox on Monday November 20, 2023 @08:09AM (#38347436)
I'm pretty sure that users care that websites can fix bugs affecting their browser. In fact option 1 is very difficult to actually implement when you can't figure out which browser is having problems in the first place.
Re:YouTube artificially slows down video load times when usi... by tzs on Monday November 20, 2023 @12:44PM (#38351367)
Why do you think users wouldn't care about sites diagnosing problems that are making pages fail to load (#2) or sites testing the site on the browser that the user uses (#3)?
Re:YouTube artificially slows down video load times when usi... by neonsunset on Monday November 20, 2023 @08:29AM (#38347693)
It is normal practice for each browser to have its own user-agent, no? But the fact that Google intentionally detected it and used polyfills or straight up invalid JS at the time was insane. A similar spin today is "Your browser is unsupported" you see here and there. When a major platform such as YouTube does it, it is really impactful.

It would never do feature detection, would give lower quality h264 video, etc. Back then, there was really nice third-party application myTube which had made this less of an issue but it was eventually killed through API changes.

Re:YouTube artificially slows down video load times when usi... by swiftcoder on Monday November 20, 2023 @08:52AM (#38348050)
It may have been intended to be a normal practice, but as far back as IE vs Netscape everyone has been mucking with user agents for non-competitive (and counter-non-competetive) reasons
Re:YouTube artificially slows down video load times when usi... by fwn on Monday November 20, 2023 @06:40AM (#38346614)
> Trying to be charitable here

There is no reason for charity with such a large power difference. For Firefox, "bugs" like this can really end up being a one-shot game.

It's like people walking by and casually reaching for your phone. It's always meant as a joke, unless you don't pull it away fast enough. Then suddenly it wasn't a joke - and your phone is gone.

Re:YouTube artificially slows down video load times when usi... by KptMarchewa on Monday November 20, 2023 @08:54AM (#38348091)
If, with Youtube size, they do not test on Firefox, this is as much malice as doing this deliberately.