Skip to content

Use bounded Range headers when probing stream headers (fixes 403 from YouTube) - #91

Open
ManfryHub wants to merge 1 commit into
philippe44:masterfrom
ManfryHub:fix/bounded-range-header-fetches
Open

Use bounded Range headers when probing stream headers (fixes 403 from YouTube)#91
ManfryHub wants to merge 1 commit into
philippe44:masterfrom
ManfryHub:fix/bounded-range-header-fetches

Conversation

@ManfryHub

Copy link
Copy Markdown

YouTube now answers 403 Forbidden to any request on googlevideo stream URLs that carries no Range header or an open-ended one (bytes=N-). Measured with curl on the URLs yt-dlp returned, same LAN / public IP, any User-Agent:

  • GET + Range: bytes=0-1023 → 206
  • GET without Range → 403 · GET + Range: bytes=0- → 403 · HEAD → 403

The main streaming loop already fetches bounded 128 KiB chunks and is fine, but the header probes done before playback (WebM::initialize, M4a::initialize) and the cue/sidx lookups used for seeking issued plain GETs, so every track failed with could not get codec info 403 Forbidden / could not get properties 403 Forbidden before a single byte was played (see issue #90).

This bounds those four requests:

  • 256 KiB for the WebM header (EBML + SeekHead + Info + Tracks are within the first few KiB; the parser stops at WEBM_DONE);
  • 128 KiB for the M4a atoms, matching the parser's existing 128*1024 cap;
  • 1 MiB from the cues offset for WebM::getStartOffset.

Tested on Daphile 25.05 / LMS 9.0.3 / yt-dlp 2026.07.04 and nightly 2026.08.18: tracks play, seeking works. No other behaviour changed.

… YouTube)

YouTube now answers 403 Forbidden to any request on googlevideo stream URLs
that carries no Range header or an open-ended one (bytes=N-). The main
streaming loop already fetches bounded 128 KiB chunks and is fine, but the
header probes done before playback (WebM::initialize, M4a::initialize) and
the cue/sidx lookups used for seeking issued plain GETs, so every track failed
with 'could not get codec info 403 Forbidden' / 'could not get properties 403
Forbidden' before a single byte was played.

Bound those requests: 256 KiB for the WebM header, 128 KiB for the M4a atoms
(matching the existing 128 KiB cap in the parser), 1 MiB from the cues offset.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant