Repository navigation
fix: YouTube 403 — retry on soft block + skip removed progressive formats - #196
Merged
Merged
Conversation
YouTube applies a short soft block (~5-8s, HTTP 403) on freshly generated googlevideo URLs. The DASH builder probes URLs immediately after extraction, landing inside that window and failing the whole manifest build. _fetch_range now retries up to 3 times with backoff (3s, 6s, 9s) on 403, while other HTTP errors are re-raised immediately.
YouTube has removed progressive (muxed) formats for many videos, so falling back to raw format 18/22 often hits a dead URL. When DASH streams are available, skip those progressive formats in the raw-format fallback.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #196 +/- ##
==========================================
- Coverage 84.48% 84.45% -0.03%
==========================================
Files 14 14
Lines 2591 2612 +21
==========================================
+ Hits 2189 2206 +17
- Misses 402 406 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
|
Thanks a lot for tracking this down, @zibaone, and for the detailed analysis and the long-running manual test! 🙏 Merged. I added a small follow-up on top in #197:
Thanks again for the contribution! Generated by Claude Code |
Contributor
Author
|
Thanks for merging our PR so quick, and for your SponsorBlock feature — great addition! 🙏 |
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.
Summary
YouTube playback in SendToKodi failed intermittently with HTTP 403. Two
contributing causes were identified:
Removed progressive formats: YouTube has removed progressive (muxed)
formats (itag 18/22) for many videos. SendToKodi fell back to
raw format 18, whose URL no longer exists → immediate 403.CDN soft block on fresh URLs: YouTube applies a short soft block
(HTTP 403, ~5-8 s) on freshly generated
googlevideo.com/videoplaybackURLs. The DASH builder probes URLs immediately after extraction, landing
inside that window → manifest build fails. A Kodi restart added enough delay
for the URL to warm up, which is why the issue appeared intermittent.
Both are addressed by this PR.
Changes
core/dash_builder.py—_fetch_rangenow retries on HTTP 403 withbackoff (3 s, 6 s, 9 s, 3 attempts). Other HTTP errors are re-raised
immediately. This absorbs the soft block for both the init/index range probe
and subsequent segment fetches.
core/playback_selection.py—evaluate_raw_format_candidateskipsprogressive (muxed) formats (itag 18/22) when DASH streams are available,
since YouTube has removed those formats for many videos.
Tests — added coverage for the retry-on-403 path (success after retry,
immediate propagation of non-403 errors) and for the progressive-format skip.
Test plan
pytest— 344 passed, 1 skipped (no regressions)