Skip to content

fix(local): pull a YouTube live link as its video - #2359

Merged
MODSetter merged 1 commit into
MODSetter:devfrom
MohammadHijjawi97:fix/youtube-live-link-one-video
Oct 28, 2026
Merged

MODSetter merged 1 commit into
MODSetter:devfrom
MohammadHijjawi97:fix/youtube-live-link-one-video

Conversation

@MohammadHijjawi97

@MohammadHijjawi97 MohammadHijjawi97 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What

A youtube.com/live/<id> link is now one source, like a watch?v= link. The YouTube puller sends the plugin the same video's watch?v=<id> link, since the plugin's resolver does not read /live/. The stored source keeps the link as pasted.

Why

docs/architecture/web-sources.md lists it as a Known gap: a /live/<id> link fit none of the puller's video paths, so Add from the web opened it as a list, which the plugin cannot read, and its group came back failed. YouTube's Share button gives this link for live streams and for past streams.

Before: PULLER.fit(urlsplit("https://www.youtube.com/live/tide1?si=x")) is Fit.LIST.
After: it is Fit.ONE, and PULLER.calls(...) sends https://www.youtube.com/watch?v=tide1 to scrape and comments.

The doc's puller table now lists /live/, and the Known gap line is deleted. A channel's /@name/live link still opens as a channel list, as before.

How to test

cd surfsense_local/backend && uv run pytest tests/unit/documents/web_sources/pullers/test_youtube.py

The new /live/ case in test_a_video_is_one_source and test_a_live_link_is_pulled_as_its_watch_page fail on dev and pass with this change. All puller tests pass (95), ruff is clean, and python scripts/check_docs.py passes.

High-level PR Summary

This PR fixes handling of YouTube live stream URLs (e.g., youtube.com/live/<id>) by converting them to standard watch URLs (watch?v=<id>) before sending to the plugin, since the plugin's resolver doesn't support the /live/ path format. The stored source preserves the original pasted link while the puller now recognizes /live/ URLs as single video sources instead of incorrectly treating them as lists.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_local/backend/modules/documents/web_sources/pullers/youtube.py
2 surfsense_local/backend/tests/unit/documents/web_sources/pullers/test_youtube.py
3 docs/architecture/web-sources.md

Need help? Join our Discord

Summary by CodeRabbit

  • Bug Fixes
    • YouTube /live/ links are now recognized and processed as individual videos, alongside other supported video URL formats.
  • Documentation
    • Updated the list of supported YouTube URL formats.

A youtube.com/live/<id> link fit no video path, so it was opened as a list, which the YouTube plugin cannot read, and its group came back failed. It is now one source, and the plugin is sent the same video's watch?v= link, since its resolver does not read /live/.
@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown

@MohammadHijjawi97 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c1ad96d and 5eb22a9.

Files selected for processing: 3
  • docs/architecture/web-sources.md
  • surfsense_local/backend/modules/documents/web_sources/pullers/youtube.py
  • surfsense_local/backend/tests/unit/documents/web_sources/pullers/test_youtube.py

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

Walkthrough

The YouTube puller now accepts supported /live/<id> URLs as video sources. It converts these URLs to equivalent watch-page URLs for scraping and comments requests. Tests and architecture documentation reflect this support.

Changes: YouTube live URL support

Layer / File(s) Summary
Live URL handling and verification
surfsense_local/backend/modules/documents/web_sources/pullers/youtube.py, surfsense_local/backend/tests/unit/documents/web_sources/pullers/test_youtube.py, docs/architecture/web-sources.md
The puller recognizes /live/<id> paths and rewrites matching URLs to watch-page URLs for its requests. Tests check classification and rewriting. The documentation lists /live/ as an accepted URL form and removes the related known-gap entry.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 5eb22

The change is ready to merge; no concrete correctness or availability risk is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: treating YouTube live links as video sources.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 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

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

@MODSetter
MODSetter merged commit d04a014 into MODSetter:dev Oct 28, 2026
23 of 25 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.

2 participants