yt-play-cli

0.15.1 • Public • Published

npm npm npm

yt-play-cli

play youtube videos ( sound only ) in the terminal using electron (and its bundled chromium)

Simple to use

npm install -g yt-play-cli

# enter interactive search and select mode
yt-play

or

npm install -g yt-play-cli

# play known video id directly
yt-play rnQBF2CIygg

Node API

const ytp = require( 'yt-play-cli' )
ytp.play( 'Wkof3nPK--Y' )
ytp.on( 'duration', function ( time ) {
    console.log( time.text )
} )

ytp.once( 'end', function () {
    process.exit()
} )

About

Play youtube videos ( music only ) from the CLI using electron.

Uses yt-search and node-fzf to search for videos to play if no CLI videoId argument is provided.

Why

To test/try/play around with electron.

How

Using electron we simply go to the youtube page and play the video.. and attach some video event listeners and block ads.

The reason we use electron instead of puppeteer is because the chromium version that comes bundled with electron can play more media types ( e.g. h264 that some YouTube video's are encoded in ) that the chromium version that puppeteer comes with can't play ( e.g. https://www.youtube.com/watch?v=pFbkURxNKPE )

Using puppeteer-core we simply go to the youtube page and play the video.. and attach some video event listeners and block ads.

Leaving video id cli argument empty you will enter search and select mode using yt-search and node-fzf

Arguments

$ yt-play [youtube-video-id]

If no video id is provided you will enter interactive search and select mode.

Installation

npm install -g yt-play-cli

Test

Searches and plays a youtube video using the CLI

npm test

Readme

Keywords

Package Sidebar

Install

npm i yt-play-cli

Weekly Downloads

6

Version

0.15.1

License

MIT

Unpacked Size

1.9 MB

Total Files

5

Last publish

Collaborators

  • talmobi