Skip to content

feat(ui): extract URLs from pasted text in shared parser#99

Merged
vanloctech merged 1 commit into
vanloctech:mainfrom
anhtahaylove:pr/url-extraction-inputs
Jul 5, 2026
Merged

feat(ui): extract URLs from pasted text in shared parser#99
vanloctech merged 1 commit into
vanloctech:mainfrom
anhtahaylove:pr/url-extraction-inputs

Conversation

@anhtahaylove

Copy link
Copy Markdown
Contributor

Summary

  • Adds a shared extractUrls() helper in src/lib/sources.ts for extracting HTTP(S) URLs from pasted text.
  • Reuses that helper across YouTube Download inputs, Universal/Gallery URL counters, parseUniversalUrls(), DownloadContext, and MetadataContext.
  • Leaves context architecture unchanged and keeps the existing cookieSkipPatterns filtering in MetadataContext.

Context

This is a focused follow-up to #95 after maintainer feedback requested a shared parser in src/lib/sources.ts instead of a MetadataContext-only change.

Tests

  • bunx biome check --write src/lib/sources.ts src/components/download/UrlInput.tsx src/components/download/UniversalUrlInput.tsx src/components/download/GalleryUrlInput.tsx src/contexts/DownloadContext.tsx src/contexts/MetadataContext.tsx tests/source-url-extraction.test.ts
  • bun test tests/source-url-extraction.test.ts
  • bun run tsc -b

Local Windows check notes

  • Full bun run lint in this clean upstream worktree is blocked by existing CRLF formatter diagnostics across unrelated files.
  • cargo check in this clean upstream worktree is blocked by the missing bundled yt-dlp resource bin\youwee-yt-dlp-x86_64-pc-windows-msvc.exe.

Pasted links often arrive inside chat messages or surrounding text, so URL input surfaces should extract HTTP(S) URLs once in src/lib/sources.ts and reuse that behavior across Download, Universal, Gallery, and Metadata without changing context architecture.

Constraint: Maintainer requested a focused shared helper after PR vanloctech#95 only touched MetadataContext.

Constraint: Metadata fetch must keep existing cookieSkipPatterns behavior.

Rejected: Rework context provider exports | unrelated to URL parsing and caused regressions in PR vanloctech#95.

Rejected: Add a parsing dependency | a small URL extractor is enough and test-covered.

Confidence: high

Scope-risk: moderate

Directive: Keep URL counting and enqueue parsing routed through extractUrls so pasted-message behavior does not drift between pages.

Tested: bunx biome check --write src/lib/sources.ts src/components/download/UrlInput.tsx src/components/download/UniversalUrlInput.tsx src/components/download/GalleryUrlInput.tsx src/contexts/DownloadContext.tsx src/contexts/MetadataContext.tsx tests/source-url-extraction.test.ts

Tested: bun test tests/source-url-extraction.test.ts

Tested: bun run tsc -b

Not-tested: Full bun run lint on Windows upstream worktree; existing CRLF line endings trigger 356 formatter diagnostics.

Not-tested: cargo check in clean PR worktree; missing bundled yt-dlp binary resource bin\\youwee-yt-dlp-x86_64-pc-windows-msvc.exe.
@vanloctech vanloctech merged commit 9525661 into vanloctech:main Jul 5, 2026
3 checks passed
@anhtahaylove anhtahaylove deleted the pr/url-extraction-inputs branch July 9, 2026 07:13
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