Skip to content

Instantly share code, notes, and snippets.

@milesrout
Forked from anonymous/youtube-terminal.py
Last active March 8, 2017 02:24
Show Gist options
  • Save milesrout/8afe45440e56966ef4696053fdc4e6a8 to your computer and use it in GitHub Desktop.
Save milesrout/8afe45440e56966ef4696053fdc4e6a8 to your computer and use it in GitHub Desktop.
Play audio from a youtube search in the terminal
#!/usr/bin/env python3
from os import system
from sys import argv
# Example:
# youtube-terminal.py foo bar baz
# calls youtube-dl 'ytsearch:foo bar baz' --max-downloads 1 -o - | cvlc - --no-video
call = 'youtube-dl "ytsearch:{}" --max-downloads 1 -o - | cvlc - --no-video'.format
system(call(' '.join(argv[1:])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment