Skip to content

Always fetch the main player JS variant - #154

Open
bishoe01 wants to merge 1 commit into
alexeichhorn:mainfrom
bishoe01:main-player-variant
Open

bishoe01 wants to merge 1 commit into
alexeichhorn:mainfrom
bishoe01:main-player-variant

Conversation

@bishoe01

@bishoe01 bishoe01 commented Nov 19, 2026 •

Copy link
Copy Markdown

Fixes #153.

YouTube is serving player 983e9c18 as player_ias_tcl.vflset/en_US/base.js to some requests. The helper finds no n or sig function in that variant, so every challenge fails with no solutions: . The main variant of the same player, 983e9c18/player_ias.vflset/en_US/base.js, solves both n and sig.

yt-dlp has the same rule: it rewrites every player URL to the main variant by default (_DEFAULT_PLAYER_JS_VARIANT = 'main', player_ias.vflset/en_US/base.js).

Change: Extraction.jsURL(html:) keeps the player ID (or PLAYER_ID_OVERRIDE) and replaces the variant path with player_ias.vflset/en_US/base.js. One new test checks that a player_ias_tcl URL comes back as the main variant.

Testing:

  • ExtractionTests, NSigTests, and SignatureTests pass.
  • Live check on macOS: 7 videos, 2 rounds, .local only. Each run found streams and then fetched the first 64 KB of itag 140, waiting out the usual first-seconds 403s. All 14 runs returned 206, and most got player 983e9c18. Before the change, 4 of 28 extractions failed, all on 983e9c18 tcl.

Note

Overview YouTubeKit now fetches the main YouTube player JavaScript variant (/player_ias.vflset/en_US/base.js) even when the page advertises a variant such as player_ias_tcl that can prevent signature extraction.

Player selection Extraction.jsURL keeps the player ID discovered on the page unless PLAYER_ID_OVERRIDE is configured. It uses that ID to build the main variant’s URL.

Some variants of a player can't be solved: with player_ias_tcl of 983e9c18,
n and sig both fail with "no solutions", while player_ias of the same player
works. yt-dlp fetches the main variant by default for the same reason.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Extraction.jsURL now rewrites matched player script URLs with the extracted player ID when no override is set, or with PLAYER_ID_OVERRIDE when present. It replaces the matched variant suffix with /player_ias.vflset/en_US/base.js. A new test checks the rewrite for an input URL containing player_ias_tcl.vflset.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 131d2

The change makes player script fetching always use the main player variant, which avoids the reported empty-solution failures on the tcl variant. No actionable merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the URL rewrite now always selects the main player JS variant. The title is short and specific, and it matches the code and test changes in the summary.
Description check Passed The description explains the bug, the linked issue (#153), the change to Extraction.jsURL(html:), the new test, and the testing done. It relates directly to the changeset.
Linked Issues check Passed Issue #153 reports that n and sig solving fail with "no solutions" for player 983e9c18 when fetched as player_ias_tcl.vflset. Its observed failures are limited to the tcl variant and to .local extract…
Out of Scope Changes check Passed The PR changes only Extraction.jsURL(html:) in Sources/YouTubeKit/Extraction.swift, plus one new test in Tests/YouTubeKitTests/ExtractionTests.swift per the raw summary. The new constant PLAYER_JS_VAR…
Full details: Linked Issues check

Explanation

Issue #153 reports that n and sig solving fail with "no solutions" for player 983e9c18 when fetched as player_ias_tcl.vflset. Its observed failures are limited to the tcl variant and to .local extractions. The head file Sources/YouTubeKit/Extraction.swift shows jsURL(html:) now rewrites any /s/player/{ID}/{VARIANT} URL to {ID}/player_ias.vflset/en_US/base.js, using PLAYER_ID_OVERRIDE when set. The production fetch path therefore no longer requests the tcl variant, so the reported failure condition is avoided. The issue has no explicit acceptance criteria beyond solving on this player. Limits: the diff tool was unavailable, so the change was verified from the head file and the PR summary, not from a diff. The solver and ejs helper were not changed, and SignatureSolver(js:) still fails on tcl JS if called directly, as the issue repro shows. The live macOS results (14 of 14 HTTP 206) are author-reported and were not independently verified.

Full details: Out of Scope Changes check

Explanation

The PR changes only Extraction.jsURL(html:) in Sources/YouTubeKit/Extraction.swift, plus one new test in Tests/YouTubeKitTests/ExtractionTests.swift per the raw summary. The new constant PLAYER_JS_VARIANT_PATH and the rewrite logic directly serve issue #153 by selecting the main player variant. The rewrite now applies to all players, not only to tcl, which is broader than the tcl symptom alone. This matches the stated design, which follows yt-dlp's default main-variant rule. The test directly covers the new behavior. No unrelated changes were identified. The test file diff could not be read directly, so its content rests on the raw summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b22de93e-914e-4ce5-a59d-5b40dea5492a
Commits

Reviewing files that changed from the base of the PR and between 7f75a22 and 131d2bc.

Files selected for processing: 2

  • Sources/YouTubeKit/Extraction.swift
  • Tests/YouTubeKitTests/ExtractionTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

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.

n and sig solving fail with "no solutions" on player 983e9c18 (player_ias_tcl)

1 participant