Skip to content

[YouTube] Fix HTTP 403 on DASH fragments by adding android_vr client#33246

Open
dcsoft4 wants to merge 3 commits intoytdl-org:masterfrom
dcsoft4:fix-youtube-403-dash-fragments
Open

[YouTube] Fix HTTP 403 on DASH fragments by adding android_vr client#33246
dcsoft4 wants to merge 3 commits intoytdl-org:masterfrom
dcsoft4:fix-youtube-403-dash-fragments

Conversation

@dcsoft4
Copy link
Copy Markdown

@dcsoft4 dcsoft4 commented Feb 9, 2026

Bug

Downloading videos with -f bestvideo+bestaudio fails with repeated HTTP Error 403: Forbidden on DASH audio fragments. All 10 retry attempts fail.

Verbose output

$ youtube-dl -v -f bestvideo+bestaudio https://www.youtube.com/watch?v=ZpgXGi3uN1I
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-f', 'bestvideo+bestaudio', 'https://www.youtube.com/watch?v=ZpgXGi3uN1I']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dl version 2025.04.07
[debug] Git HEAD: 956b8c585
[debug] Python 3.12.5 (CPython AMD64 64bit) - Windows-11-10.0.26200-SP0 - OpenSSL 3.0.14 4 Jun 2024
[debug] exe versions: ffmpeg 2025-01-08-git-251de1791e-full_build-www.gyan.dev, ffprobe 2025-01-08-git-251de1791e-full_build-www.gyan.dev
[debug] Proxy map: {}
[youtube] ZpgXGi3uN1I: Downloading webpage
[youtube] ZpgXGi3uN1I: Downloading ANDROID API JSON
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] Bay View at Richmond _ Richmond, CA-ZpgXGi3uN1I.f137.mp4 has already been downloaded
[download] 100% of 20.00MiB
[dashsegments] Total fragments: 1
[download] Destination: Bay View at Richmond _ Richmond, CA-ZpgXGi3uN1I.webm.f251.webm
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 1 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 2 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 3 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 4 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 5 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 6 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 7 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 8 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 9 of 10)...
[download] Got server HTTP error: HTTP Error 403: Forbidden. Retrying fragment 1 (attempt 10 of 10)...
ERROR: giving up after 10 fragment retries

Root cause

The android_sdkless InnerTube client has become unreliable — YouTube's CDN now blocks its streaming URLs after a few range-based fragment requests. This was identified and fixed in yt-dlp (yt-dlp/yt-dlp#15726), which replaced android_sdkless with android_vr.

Changes

  • Add android_vr client (Oculus Quest 3) as first-priority InnerTube client. Like android_sdkless, it does not require a JS player or PO Token, but its streaming URLs are not blocked by YouTube's CDN
  • Remove break on n parameter in the format loop. The break (added in 5d445f8c5) prevented all formats from being added when any URL contained an n parameter, and also prevented _unthrottle_format_urls from ever being reached
  • Set client User-Agent on format download headers so fragment download requests use the same User-Agent as the API call that obtained the streaming URLs, avoiding CDN rejection from UA mismatch

References

- Add android_vr (Oculus Quest 3) as first-priority InnerTube client,
  replacing android_sdkless which is now blocked by YouTube's CDN
- Remove break on n parameter that prevented all formats from being added
- Set client User-Agent on format download headers to avoid CDN mismatch

Ref: yt-dlp/yt-dlp#15726

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dirkf
Copy link
Copy Markdown
Contributor

dirkf commented Feb 11, 2026

Thanks for your work and its suspiciously literate and detailed explanation.

I don't think you (or your assistant) fully understand the somewhat half-hacked code in the current extractor version. Until an external JS solution like that in yt-dlp is added, there won't be any unthrottling. That's why we need whichever format is sent without the n-challenge: today it's Android VR.

Anyhow, #33244.

@dirkf dirkf linked an issue Feb 11, 2026 that may be closed by this pull request
5 tasks
@s1sw4nto
Copy link
Copy Markdown

Thanks, this working

@dirkf dirkf mentioned this pull request Feb 12, 2026
5 tasks
@dcsoft4
Copy link
Copy Markdown
Author

dcsoft4 commented Feb 13, 2026

@dirkf I reverted the n parameter break as requested, please review again when you have a chance, thanks!

@dcsoft4 dcsoft4 requested a review from dirkf February 13, 2026 01:01
nicolaasjan added a commit to nicolaasjan/youtube-dl that referenced this pull request Feb 13, 2026
Fix HTTP 403 on DASH fragments by adding android_vr client (ytdl-org#33246)
@dirkf
Copy link
Copy Markdown
Contributor

dirkf commented Mar 7, 2026

yt-dlp/yt-dlp#16150

'INNERTUBE_CONTEXT': {
'client': {
'clientName': 'ANDROID_VR',
'clientVersion': '1.62.27',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From yt-dlp/yt-dlp#16150 (comment), the version can be this later one, but not later.

Suggested change
'clientVersion': '1.62.27',
'clientVersion': '1.65.10',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do that remember to also change the version number in the user agent 4 lines below (I forgot to do that in the linked comment)

Co-authored-by: dirkf <fieldhouse@gmx.net>
Copy link
Copy Markdown
Author

@dcsoft4 dcsoft4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userAgent version updated to 1.65.10 as requested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[YouTube] HTTP Error 403: Forbidden

4 participants