Skip to content

Fix video ID extraction for reordered YouTube watch URLs - #2

Merged
R4ULtv merged 1 commit into
mainfrom
codex/find-bugs-in-the-codebase
Mar 30, 2026
Merged

Fix video ID extraction for reordered YouTube watch URLs#2
R4ULtv merged 1 commit into
mainfrom
codex/find-bugs-in-the-codebase

Conversation

@R4ULtv

@R4ULtv R4ULtv commented Mar 30, 2026

Copy link
Copy Markdown
Owner

Motivation

  • The previous scraper used a strict regex that only matched /watch?v=<id> when v was the first query parameter, which caused valid video links like /watch?pp=...&v=<id> to be skipped.
  • Make ID extraction more robust to different YouTube URL shapes so repeated videos are not missed.

Description

  • Add an extractVideoId(href: string) helper in src/scraper.ts that parses the URL with new URL(...) and uses searchParams.get("v") with an 11-character validation.
  • The helper also supports alternative path-based forms by checking for /watch/<id> in the pathname.
  • Update scrapeVideoIds() to use extractVideoId() instead of the previous regex, keeping existing playlist filtering and deduplication logic unchanged (file modified: src/scraper.ts).

Testing

  • Ran bun run check (runs tsc --noEmit, oxlint, and oxfmt --check) and all checks passed successfully.

Codex Task

@R4ULtv R4ULtv added the bug Something isn't working label Mar 30, 2026
@R4ULtv R4ULtv self-assigned this Mar 30, 2026
@R4ULtv
R4ULtv merged commit 7213b43 into main Mar 30, 2026
1 check passed
@R4ULtv
R4ULtv deleted the codex/find-bugs-in-the-codebase branch March 30, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant