STOPHY

CLI

YouTube for AI Agents. Search, transcripts, comments, channels, playlists.

@stophy/cli is a CLI for the Stophy API. Search, transcripts, comments, channels, playlists. All output goes to stdout as JSON.

Install

npm install -g @stophy/cli

Requires Node.js 18 or later.

Authentication

stophy login                        # interactive — browser or API key
stophy login --browser              # open browser directly
stophy login --api-key st_xxx       # paste key directly
export STOPHY_API_KEY="st_..."      # or set env var

Get your API key from stophy.dev/dashboard.

Environment variable

If STOPHY_API_KEY is set, the CLI uses it automatically. No login required. Useful in CI/CD and scripts.

STOPHY_API_KEY=st_xxx stophy search --q "typescript"

Commands

Search YouTube by keyword with filters for type, date, duration, and sort order.

stophy search --q "typescript tutorial"
stophy search --q "next.js" --type video --sortBy viewCount
stophy search --q "AI news" --uploadDate today --duration short
stophy search --q "python" --continuation-token <token>

Options

OptionValuesDescription
--q <query>anySearch query (required)
--type <type>video, channel, playlistContent type filter
--sortBy <sort>relevance, uploadDate, viewCount, ratingSort order
--uploadDate <date>hour, today, week, month, yearUpload recency
--duration <duration>short, medium, longUnder 4 min / 4–20 min / over 20 min
--continuation-tokenstringFetch the next page of results
--jsonPrint raw JSON

suggest

Get YouTube autocomplete suggestions for a partial query.

stophy suggest --q "how to"
stophy suggest --q "typescript" --hl en --gl US

Options

OptionValuesDescription
--q <query>anyPartial search query (required)
--hl <lang>e.g. en, frLanguage code (default: en)
--gl <country>e.g. US, FRCountry code (default: US)
--jsonPrint raw JSON

video details

Get metadata for a YouTube video: title, views, description, channel, thumbnails.

stophy video details --url "https://www.youtube.com/watch?v=h6ukrWyqOm4"
stophy video details --url "https://www.youtube.com/watch?v=h6ukrWyqOm4" --json | jq '.data.title'

video transcript

Get the full transcript with timestamps.

stophy video transcript --url "https://www.youtube.com/watch?v=h6ukrWyqOm4"
stophy video transcript --url "https://www.youtube.com/watch?v=h6ukrWyqOm4" --json | jq '.data.segments[].text'

video comments

Get comments for a video, sorted by top or latest. Supports pagination.

stophy video comments --url "https://www.youtube.com/watch?v=h6ukrWyqOm4"
stophy video comments --url "https://www.youtube.com/watch?v=h6ukrWyqOm4" --sortBy top
stophy video comments --url "https://www.youtube.com/watch?v=h6ukrWyqOm4" --continuation-token <token>

Options

OptionValuesDescription
--url <url>YouTube video URLRequired
--sortBy <sort>top, latestComment sort order
--continuation-tokenstringFetch the next page
--jsonPrint raw JSON

video replies

Get replies to a comment using the repliesToken from a comments response.

stophy video replies --continuation-token "<repliesToken>"

channel

Browse a channel's videos, shorts, playlists, or about page.

stophy channel --url "https://www.youtube.com/@t3dotgg"
stophy channel --url "https://www.youtube.com/@t3dotgg" --tab video --sortBy popular
stophy channel --url "https://www.youtube.com/@t3dotgg" --tab about
stophy channel --url "https://www.youtube.com/@t3dotgg" --tab playlist

Options

OptionValuesDescription
--url <url>YouTube channel URL or @handleRequired
--tab <tab>video, short, playlist, aboutWhich tab to fetch (default: video)
--sortBy <sort>latest, popular, oldestSort order. Only applies with --tab video.
--continuation-tokenstringFetch the next page
--jsonPrint raw JSON

playlist

Get all videos in a playlist with full metadata.

stophy playlist --url "https://www.youtube.com/playlist?list=PLxxxxxx"
stophy playlist --url "https://www.youtube.com/playlist?list=PLxxxxxx" --json | jq '.data.videos[].title'

credits

Check your remaining credit balance. Free. Doesn't cost a credit.

stophy credits
# Credits remaining: 39142

stophy credits --json

usage

Show API usage for your key over a time range.

stophy usage
stophy usage --days 30
stophy usage --days today --json

Options

OptionValuesDescription
--days <days>today, 7, 30Time range (default: 7)
--jsonPrint raw JSON

logs

Show request logs for your key.

stophy logs
stophy logs --days 30 --endpoint /v1/search

Options

OptionValuesDescription
--days <days>today, 7, 30Time range (default: 7)
--endpoint <endpoint>e.g. /v1/searchFilter by endpoint
--jsonPrint raw JSON

view-config

Show your current config and auth status.

stophy view-config

logout

Clear saved credentials.

stophy logout

Piping output

All commands output JSON to stdout. Status messages and prompts go to stderr so piping works cleanly.

# Extract just the titles from search results
stophy search --q "react tutorial" --json | jq '.data.results[].title'

# Get transcript text as plain string
stophy video transcript --url "https://www.youtube.com/watch?v=h6ukrWyqOm4" --json \
  | jq '.data.segments[].text' -r | tr '\n' ' '

# Pipe channel videos into another command
stophy channel --url "https://www.youtube.com/@t3dotgg" --json \
  | jq '.data.items[].url' -r

Config file

Credentials and settings are stored at:

  • Linux / macOS: ~/.config/stophy/config.json
  • Windows: %APPDATA%\stophy\config.json

The file is restricted to owner read/write (0600). You can inspect the path with stophy view-config.

On this page