Skip to content

feat: flacfetch-remote accepts direct YouTube/yt-dlp URLs - #45

Merged
beveradb merged 3 commits into
mainfrom
feat/sess-20260826-2154-remote-youtube-url
Aug 27, 2026
Merged

feat: flacfetch-remote accepts direct YouTube/yt-dlp URLs#45
beveradb merged 3 commits into
mainfrom
feat/sess-20260826-2154-remote-youtube-url

Conversation

@beveradb

Copy link
Copy Markdown
Collaborator

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)

  • Auto-detect a bare http(s):// URL passed as the sole positional arg (when no -a/-t given), plus an explicit -u/--url flag.
  • Routing:
    • YouTube URLs → source_name='YouTube' with the extracted 11-char video ID (server's YouTube cookies/downloader path). Handles watch?v=, youtu.be/, shorts/, embed/, live/, music.youtube.com, and list=…&v= ordering. Host is validated first so a non-YouTube URL embedding a YouTube link in a query param is not misrouted.
    • Any other URL → generic source_name='URL', handed straight to yt-dlp (SoundCloud, Vimeo, Bandcamp, Facebook, TikTok, …).
  • New RemoteClient.download_by_id(); the search flow's download/fetch/summary tail extracted into a shared _finish_download().
  • Old artist-required error now hints at direct-URL usage.
flacfetch-remote https://www.youtube.com/watch?v=G8sU-HHDk8s   # → YouTube
flacfetch-remote https://soundcloud.com/artist/track           # → URL (yt-dlp)
flacfetch-remote --url https://vimeo.com/12345                 # → URL (yt-dlp)

Tests

  • 15 new unit tests: URL detection, YouTube-ID extraction (incl. the embedded-URL regression case), and download_by_id payload construction for YouTube and generic-URL+GCS.
  • Full suite: 632+ passing. Search flow unchanged (still requires artist+title).

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

beveradb and others added 3 commits August 26, 2026 22:08
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

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.45455% with 105 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
flacfetch/interface/cli_remote.py 20.45% 105 Missing ⚠️
Flag Coverage Δ
unittests 45.65% <20.45%> (-5.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
flacfetch/interface/cli_remote.py 9.80% <20.45%> (-4.74%) ⬇️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@beveradb
beveradb merged commit 0f268fb into main Aug 27, 2026
5 of 6 checks passed
@beveradb
beveradb deleted the feat/sess-20260826-2154-remote-youtube-url branch August 27, 2026 02:22
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.

1 participant