Package Exports
- @tubealfred/cli
- @tubealfred/cli/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tubealfred/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@tubealfred/cli
Command-line access to the TubeAlfred YouTube API.
Install
Run on demand:
npx -y @tubealfred/cli --helpOr install globally:
npm install -g @tubealfred/cliAuthentication
Prefer an environment variable so your API key does not appear in shell history:
export TUBEALFRED_API_KEY=ta_live_...Test keys are also supported:
export TUBEALFRED_API_KEY=ta_test_...You can pass a key with --api-key, but environment variables are safer for regular use.
Configuration
Production is the default API target:
https://api.tubealfred.comOverride it only for local or staging testing:
export TUBEALFRED_API_URL=http://localhost:8000or:
tubealfred --api-url http://localhost:8000 video VIDEO_IDNetwork controls:
tubealfred --timeout 60000 --retries 2 video VIDEO_IDCommands
tubealfred video VIDEO_ID
tubealfred transcript VIDEO_ID
tubealfred comments VIDEO_ID --count 100
tubealfred comments-page VIDEO_ID --continuation-token TOKEN --count 100
tubealfred replies VIDEO_ID COMMENT_ID --count 100
tubealfred replies-page VIDEO_ID COMMENT_ID --continuation-token TOKEN --count 100
tubealfred channel CHANNEL_ID_OR_HANDLE
tubealfred channel-about CHANNEL_ID_OR_HANDLE
tubealfred channel-videos CHANNEL_ID_OR_HANDLE
tubealfred channel-shorts CHANNEL_ID_OR_HANDLE
tubealfred channel-playlists CHANNEL_ID_OR_HANDLE
tubealfred channel-community CHANNEL_ID_OR_HANDLE
tubealfred search "laravel queues"
tubealfred hashtag "#laravel"
tubealfred suggestions "laravel"
tubealfred playlist PLAYLIST_ID
tubealfred resolve "https://www.youtube.com/watch?v=dQw4w9WgXcQ"Output
Default output is pretty JSON for most commands:
tubealfred video VIDEO_IDCompact JSON:
tubealfred --format json video VIDEO_IDBackward-compatible compact JSON shortcut:
tubealfred --json video VIDEO_IDTranscript text output:
tubealfred transcript VIDEO_IDWrite output to a file:
tubealfred --output transcript.txt transcript VIDEO_IDPagination
Some commands return a continuation token when more results are available. Pass that token into the matching page command:
tubealfred comments VIDEO_ID --count 100
tubealfred comments-page VIDEO_ID --continuation-token TOKEN --count 100
tubealfred replies VIDEO_ID COMMENT_ID --count 100
tubealfred replies-page VIDEO_ID COMMENT_ID --continuation-token TOKEN --count 100Channel, playlist, search, hashtag, Shorts, playlists, and community pagination use the same --continuation-token option:
tubealfred search "creator economy" --continuation-token TOKEN
tubealfred hashtag "#creator" --continuation-token TOKEN
tubealfred channel-shorts @mkbhd --continuation-token TOKENCI Usage
Set TUBEALFRED_API_KEY in your CI secret store, then call the CLI normally:
npx -y @tubealfred/cli --format json video VIDEO_IDTroubleshooting
Missing TUBEALFRED_API_KEY: exportTUBEALFRED_API_KEYor pass--api-key.API key must look like...: check that the key starts withta_live_orta_test_.Request timed out: increase--timeoutor retry later.HTTP 401orHTTP 403: check API key validity and account access.HTTP 429: reduce request rate or retry after your limit resets.Text output is not available: use--format prettyor--format jsonfor non-transcript responses.
Development
pnpm install
pnpm typecheck
pnpm test
pnpm buildLicense
MIT