Skip to content

Fix high resolution streams - #5

Merged
alexeichhorn merged 1 commit into
cloudflare-workerfrom
fix/high-res-streams-june-26
Jun 12, 2026
Merged

alexeichhorn merged 1 commit into
cloudflare-workerfrom
fix/high-res-streams-june-26

Conversation

@alexeichhorn

@alexeichhorn alexeichhorn commented Jun 12, 2026 •

Copy link
Copy Markdown
Owner

Updates the server to use the YouTube.js fork commit that pins Android VR to the older client version which still returns playable direct high-resolution stream URLs.

Also deduplicates returned streams by itag so querying fallback clients does not surface duplicate stream entries. The end goal is for YouTubeKit clients to receive working 720p and 1080p video streams for videos such as Z5uv7_ysu9M.


Note

Medium Risk
Stream resolution depends on a specific git fork commit of youtubei.js, and deduplication keeps the first stream per itag when multiple clients disagree.

Overview
Pins youtubei.js to fork commit 4f74d89a (replacing the feat/android-sdkless-client branch) so Android VR uses the older client behavior that still yields playable direct URLs for 720p/1080p.

YouTubeService.getStreams now runs returned streams through a new deduplicateStreams helper that keeps one entry per itag, including on the WEB_EMBEDDED fallback path, so multi-client aggregation no longer returns duplicate stream rows.

Reviewed by Cursor Bugbot for commit 624b6ac. Bugbot is set up for automated code reviews on this repo. Configure here.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
youtubekit-server 624b6ac Jun 12 2026, 08:11 AM

@alexeichhorn
alexeichhorn marked this pull request as ready for review June 12, 2026 10:58
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5fd9b44e-b90c-4753-a672-ed7febb83dab

📥 Commits

Reviewing files that changed from the base of the PR and between 97cd9eb and 624b6ac.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • src/youtube/service.ts

📝 Walkthrough

Walkthrough

This PR pins the youtubei.js dependency to a specific commit and adds deduplication logic to the YouTube service's getStreams() method, ensuring no duplicate streams (by itag) are returned from either the primary or fallback client paths.

Changes

Stream deduplication feature

Layer / File(s) Summary
Dependency pinning
package.json
The youtubei.js dependency reference is updated from a branch to a specific GitHub commit.
Stream deduplication helper and integration
src/youtube/service.ts
A new deduplicateStreams() method filters RemoteStream entries by itag to retain only the first stream per unique itag. The getStreams() method now applies deduplication to both fallback client results and the final aggregated stream list.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • alexeichhorn/YouTubeKit-Server#3: Modifies the Innertube clients queried in getStreams(), which works alongside the deduplication logic introduced in this PR.
  • alexeichhorn/YouTubeKit-Server#1: Changes how RemoteStream objects are constructed during stream assembly, affecting the streams passed to the new deduplication logic.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix high resolution streams' is directly related to the changeset, which updates YouTubei.js to pin a commit supporting playable high-resolution streams and deduplicates streams by itag.
Description check ✅ Passed The description is directly related to the changeset, explaining the youtubei.js fork commit pin for 720p/1080p stream support and the deduplication mechanism in YouTubeService.getStreams.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/high-res-streams-june-26

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@alexeichhorn
alexeichhorn merged commit 8f64e82 into cloudflare-worker Jun 12, 2026
4 checks passed
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