feat(ui): extract URLs from pasted text in shared parser#99
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
extractUrls()helper insrc/lib/sources.tsfor extracting HTTP(S) URLs from pasted text.parseUniversalUrls(), DownloadContext, and MetadataContext.cookieSkipPatternsfiltering in MetadataContext.Context
This is a focused follow-up to #95 after maintainer feedback requested a shared parser in
src/lib/sources.tsinstead 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.tsbun test tests/source-url-extraction.test.tsbun run tsc -bLocal Windows check notes
bun run lintin this clean upstream worktree is blocked by existing CRLF formatter diagnostics across unrelated files.cargo checkin this clean upstream worktree is blocked by the missing bundled yt-dlp resourcebin\youwee-yt-dlp-x86_64-pc-windows-msvc.exe.