feat: flacfetch-remote accepts direct YouTube/yt-dlp URLs - #45
Merged
Conversation
Allow 'flacfetch-remote <url>' (or --url) to download a specific YouTube or any yt-dlp-supported URL directly, skipping the artist/title torrent search that previously rejected bare URLs with 'Artist name is required'. YouTube URLs route via source_name='YouTube' (extracted video ID); other URLs via the generic source_name='URL'. Uses the existing server POST /download-by-id endpoint (no server change). Adds RemoteClient.download_by_id() and unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CodeRabbit: _extract_youtube_id matched the video-ID pattern anywhere in the string, so a non-YouTube URL embedding a YouTube link in a query param (e.g. ?next=) was misrouted as a YouTube download. Parse and validate the host (youtu.be / youtube.com / *.youtube.com) first. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
What & why
flacfetch-remote <url>previously failed with "Artist name is required for remote downloads" — the CLI treated a single positional arg as a title and demanded an artist for a torrent search, never considering the arg could be a URL. This makes it work.The flacfetch server already supported direct-URL downloads via
POST /download-by-id(source_name='YouTube'for video IDs,source_name='URL'for any yt-dlp site). This gap was purely client-side — no server change or deploy required.Changes (
flacfetch/interface/cli_remote.py)http(s)://URL passed as the sole positional arg (when no-a/-tgiven), plus an explicit-u/--urlflag.source_name='YouTube'with the extracted 11-char video ID (server's YouTube cookies/downloader path). Handleswatch?v=,youtu.be/,shorts/,embed/,live/,music.youtube.com, andlist=…&v=ordering. Host is validated first so a non-YouTube URL embedding a YouTube link in a query param is not misrouted.source_name='URL', handed straight to yt-dlp (SoundCloud, Vimeo, Bandcamp, Facebook, TikTok, …).RemoteClient.download_by_id(); the search flow's download/fetch/summary tail extracted into a shared_finish_download().Tests
download_by_idpayload construction for YouTube and generic-URL+GCS.Review
Local CodeRabbit review completed; 1 minor finding (host validation) fixed. Version bumped 0.26.0 → 0.27.0.
🤖 Generated with Claude Code
@coderabbitai ignore