random_user_agent's Chrome versions are out of date #26685

Open
opened 2026-02-21 13:17:21 -05:00 by deekerman · 2 comments
Owner

Originally created by @jdebp on GitHub (Aug 29, 2023).

Just a quick note. The random_user_agent() function in utils.py is using a selection of Chrome versions from major versions 74 to 76. This set of versions hasn't changed since it was first committed in f7a147e3b6 in 2019.

I have encountered at least one site where the site now, as of a few days ago, serves incomplete content, lacking information in JSON parsed by the extractor, to those Chrome versions. I compared the few hundred lines of JSON that the extractor was seeing, with the several thousand lines of JSON seen in view source in an up-to-date Vivaldi browser.

I updated the random list to Chrome major versions 114 to 116 and that fixed the problem.

Chrome turned 100 back in 2022, and it looks like some site operators have recently decided (or maybe accidentally changed things) to only minimally support things claiming to be older. Chrome Stable for Desktop is on 116 as I write this. The Vivaldi browser was claiming to be 114.

I'd do you a pull request but I'm not in a position to. It was basically just a s/'7/'11/ over the list of _CHROME_VERSIONS, though. You'll probably want to use a list of real 114-116 versions, anyway, not that quick bodge of mine. ☺

Originally created by @jdebp on GitHub (Aug 29, 2023). Just a quick note. The `random_user_agent()` function in `utils.py` is using a selection of Chrome versions from major versions 74 to 76. This set of versions hasn't changed since it was first committed in f7a147e3b63a3165c425c56ee19e66f86900128c in 2019. I have encountered at least one site where the site _now_, as of a few days ago, serves incomplete content, lacking information in JSON parsed by the extractor, to those Chrome versions. I compared the few hundred lines of JSON that the extractor was seeing, with the several thousand lines of JSON seen in view source in an up-to-date Vivaldi browser. I updated the random list to Chrome major versions 114 to 116 and that fixed the problem. [Chrome turned 100 back in 2022](https://developer.chrome.com/blog/force-major-version-to-100/), and it looks like some site operators have recently decided (or maybe accidentally changed things) to only minimally support things claiming to be older. [Chrome Stable for Desktop is on 116](https://chromereleases.googleblog.com/2023/08/stable-channel-update-for-desktop_29.html) as I write this. The Vivaldi browser was claiming to be 114. I'd do you a pull request but I'm not in a position to. It was basically just a `s/'7/'11/` over the list of `_CHROME_VERSIONS`, though. You'll probably want to use a list of real 114-116 versions, anyway, not that quick bodge of mine. ☺
Author
Owner

@dirkf commented on GitHub (Aug 30, 2023):

Good point. But pls reveal which extractor was affected.

Without updating the "random" list, you can override the UA per invocation (--user-agent ...) or by modifying the extractor.

Quite recently (ie, in a version I can easily check) yt-dlp was still using versions in the range 90-97, so moving to ~115 may not be strictly necessary. Syncing the version data might be the best solution for support. If it made no difference to yt-dl operation I'd favour sending fake Firefox UAs to even up the stats.

Also, or fortunately, UA versions like this are supposed to be deprecated sometime soon.

@dirkf commented on GitHub (Aug 30, 2023): Good point. But pls reveal which extractor was affected. Without updating the "random" list, you can override the UA per invocation (`--user-agent ...`) or by modifying the extractor. Quite recently (ie, in a version I can easily check) _yt-dlp_ was still using versions in the range 90-97, so moving to ~115 may not be strictly necessary. Syncing the version data might be the best solution for support. If it made no difference to yt-dl operation I'd favour sending fake Firefox UAs to even up the stats. Also, or fortunately, UA versions like this are supposed to be deprecated sometime soon.
Author
Owner

@gamer191 commented on GitHub (Aug 31, 2023):

yt-dlp was still using versions in the range 90-97

Yes, and IIRC there were issues switching to those user agents, since yt-dlp wasn't sending all the headers that chrome 90 sent.

Given youtube-dl's focus on backwards compatibility, I think it would make sense to switch to yt-dlp's user agent versions, after making all the necessary changes to prevent regressions, if anyone remembers what the were. Future user-agent upgrades (if they ever occur) should imo be tested first in yt-dlp nightly, then yt-dlp stable, and eventually backported to youtube-dl

@gamer191 commented on GitHub (Aug 31, 2023): > _yt-dlp_ was still using versions in the range 90-97 Yes, and IIRC there were issues switching to those user agents, since yt-dlp wasn't sending all the headers that chrome 90 sent. Given youtube-dl's focus on backwards compatibility, I think it would make sense to switch to yt-dlp's user agent versions, after making all the necessary changes to prevent regressions, if anyone remembers what the were. Future user-agent upgrades (if they ever occur) should imo be tested first in yt-dlp nightly, then yt-dlp stable, and eventually backported to youtube-dl
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl#26685
No description provided.