Skip to content
/ ytplay Public
forked from cybardev/ytpy

A Python script to find and watch YouTube videos from the terminal without requiring API keys.

License

Notifications You must be signed in to change notification settings

thieung/ytplay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

figlet

A Python script to play media from YouTube without needing API keys.

Sections:

Click to navigate.

Dependencies

Installation

  • Download the file from the Releases page: ytplay
  • Place it in your $PATH and make it executable.
  • Enjoy!

Usage

Usage: ytpy [OPTIONS] <search query>
           OPTIONS:
             -h                    Show this help text
             -d  <search query>    Download video
             -v  <search query>    Play video (audio-only if not specified)
             -u  <search query>    Fetch video URL

List of mpv hotkeys: https://defkey.com/mpv-media-player-shortcuts

Examples

  • Stream audio:

    ytpy gurenge band cover

  • Watch a video:

    ytpy -v rickroll

  • Download a video:

    ytpy -d penguin flock

  • Play the audio of the second search result:

    YT_NUM=2 ytpy plastic love daft punk

  • Download a video to a directory other than $HOME/Videos (default location):

    YT_DLOAD_DIR=$HOME/Downloads/ ytpy -d darude sandstorm

PS: Here's a list of mpv keyboard shortcuts for your convenience.

Credits

Extras

About the .pyx file...

I'm currently not updating it anymore. Please consider using the .py file instead.

Cython is supposed to be faster but I don't really know Cython so I couldn't optimize it as well. If you can do so, feel free to make a fork, and maybe even a pull request so the script can be improved. It'll be a learning experience for me as well.

As for the performance... It may be slightly faster but the program is still network-bound. Which means, faster internet = faster query = media is played sooner.

Compile an executable file using this shell script if you want.

About

A Python script to find and watch YouTube videos from the terminal without requiring API keys.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%