Use bounded Range headers when probing stream headers (fixes 403 from YouTube) - #91
Open
ManfryHub wants to merge 1 commit into
Open
Use bounded Range headers when probing stream headers (fixes 403 from YouTube)#91ManfryHub wants to merge 1 commit into
ManfryHub wants to merge 1 commit into
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
YouTube now answers 403 Forbidden to any request on googlevideo stream URLs that carries no
Rangeheader 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→ 206GETwithoutRange→ 403 ·GET+Range: bytes=0-→ 403 ·HEAD→ 403The 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 withcould not get codec info 403 Forbidden/could not get properties 403 Forbiddenbefore a single byte was played (see issue #90).This bounds those four requests:
WEBM_DONE);128*1024cap;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.