Skip to content

feat: search YouTube when add is given words instead of a link - #20

Open
flintwinters wants to merge 1 commit into
baairon:mainfrom
flintwinters:feat/add-search
Open

flintwinters wants to merge 1 commit into
baairon:mainfrom
flintwinters:feat/add-search

Conversation

@flintwinters

@flintwinters flintwinters commented Nov 22, 2026 •

Copy link
Copy Markdown

Hi, and thank you for soundcli. I'm sorry for my first version of this PR, which added a flag plus README and help edits. I've reworked it to touch neither. I'm happy to change or drop this if it doesn't fit the project.

What

sndcli add "artist song name" used to fail with "Not a link". Input containing a space can't be a handle, so add now treats it as a YouTube search, takes the top result, and queues it the way a pasted link would be.

How

  • No new flags, no README change, no --help change. The only behavior change is for input that previously errored.
  • A single bare word still errors as before, since it could be a handle on any site.
  • It reuses searchYouTube() from the Spotify matcher, so there's no new download path.
  • The chosen URL is printed to stderr, so a wrong guess is easy to spot. stdout and --json output are unchanged.
  • A search with no result exits 1 before anything is claimed or queued.
  • Search is a HeadlessDeps seam, so tests never touch the network.

Checks

  • npm run typecheck and npm test pass, with new tests for the top-result path, the empty-search path, and the bare-word-still-errors path.
  • I haven't tried a real search against YouTube end to end, only through the mocked seam, so a real-world check would be welcome.
  • Commits follow Conventional Commits.

`sndcli add "artist song"` used to fail with "Not a link". Input that
contains whitespace can't be a handle, so `add` now treats it as a YouTube
search, takes the top result, and queues it through the same path a pasted
link takes.

- No new flags or help text; the only behavior change is for input that
  previously errored.
- A single bare word still errors as before, since it could be a handle on
  any site.
- Reuses searchYouTube() from the Spotify matcher; no new download path.
- The chosen URL is printed to stderr so a wrong guess is easy to spot;
  stdout and --json output are unchanged.
- A search with no result exits 1 before anything is claimed or queued.
- Search is a HeadlessDeps seam so tests never touch the network.

Tests: top result used for words; empty search fails cleanly; a bare word
still errors and never searches.
@flintwinters flintwinters changed the title feat: add --search to download the top YouTube result for plain words feat: search YouTube when add is given words instead of a link Nov 22, 2026
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