Terminal based YouTube player and downloader This program was suggested on another site and I thought it was worth mentioning here just because its pretty darn cool.
The program makes no registry entries that I could tell but it isnt stealth;
It stores its settings in user/appdata and default settings configured to check for an update
I tested with MPC-HC and it works great.
License: GPL3
If you know how to compile from the source files, there are more features currently available.
This is the Latest Release already put together if not.
Features
- Search and play audio/video from YouTube
- Search tracks of albums by album title
- Search and import YouTube playlists
- Create and save local playlists
- Download audio/video
- Convert to mp3 & other formats (requires ffmpeg or avconv)
- View video comments
- Works with Python 3.x
- Works with Windows, Linux and Mac OS X
- Requires mplayer or mpv
This implementation uses YouTube as a source of content and can play and download video
as well as audio. The pafy library handles interfacing with YouTube.
Code: Select all
_ _
_ __ ___ _ __ ___ _ _ ___ _ _| |_ _ _| |__ ___
| '_ ` _ \| '_ \/ __|_____| | | |/ _ \| | | | __| | | | '_ \ / _ \
| | | | | | |_) \__ \_____| |_| | (_) | |_| | |_| |_| | |_) | __/
|_| |_| |_| .__/|___/ \__, |\___/ \__,_|\__|\__,_|_.__/ \___|
|_| |___/ v0.2.5
Enter /search-term to search or [h]elp
>>>>>>Help Topics<<<<<<<
Enter help <topic> for specific help:
basic : Basics
search : Searching and Retrieving
edit : Editing / Manipulating Results
download : Downloading and Playback
dl-command : Downloading Using External Application
encode : Encoding to MP3 and other formats
playlists : Using Local Playlists
invoke : Invocation Parameters
config : Configuration Optionsd 4
tips : Advanced Tips
new : New Features
>>>>>>Help Topics<<<<<<<
> help basic
Basic Usage
Use / or . to prefix your search query. e.g., /pink floyd
Then, when results are shown:
<number(s)> - play specified items, separated by commas.
e.g., 1-3,5 plays items 1, 2, 3 and 5.
i <number> - view information on video <number>
c <number> - view comments for video <number>
d <number> - download video <number>
r <number> - show videos related to video <number>
u <number> - show videos uploaded by uploader of video <number>
x <number> - copy item <number> url to clipboard (requires xerox)
q, quit - exit mpsyt
>>>>>>Help Topics<<<<<<<
> help search
Searching and Retrieving
set search_music false - search all YouTube categories.
set search_music true - search only YouTube music category.
/<query> or .<query> to search for videos. e.g., /daft punk
//<query> or ..<query> - search for YouTube playlists. e.g., //80's music
n and p - continue search to next/previous pages.
p <number> - switch to page <number>.
album <album title> - Search for matching tracks using album title
user <username> - list YouTube uploads by <username>.
user <username>/<query> - as above, but matches <query>.
userpl <username> - list YouTube playlists created by <username>.
pl <url or id> - Open YouTube playlist by url or id.
url <url or id> - Retrieve specific YouTube video by url or id.
r <number> - show videos related to video <number>.
u <number> - show videos uploaded by uploader of video <number>.
c <number> - view comments for video <number>
>>>>>>Help Topics<<<<<<<
> help edit
Editing and Manipulating Results
rm <number(s)> - remove items from displayed results.
sw <number>,<number> - swap two items.
mv <number>,<number> - move item <number> to position <number>.
save <name> - save displayed items as a local playlist.
mix <number> - show YouTube mix playlist from item in results.
shuffle - Shuffle the displayed results.
>>>>>>Help Topics<<<<<<<
> help download
Downloading and Playback
set show_video true - play video instead of audio.
<number(s)> - play specified items, separated by commas.
e.g., 1-3,5 plays items 1, 2, 3 and 5
d <number> - view downloads available for an item.
da <number(s)> - download best available audio file(s).
dv <number(s)> - download best available video file(s).
dapl <url or id> - download YouTube playlist (audio) by url or id.
dvpl <url or id> - download YouTube playlist (video) by url or id.
daupl <username> - download user's YouTube playlists (audio).
dvupl <username> - download user's YouTube playlists (video).
dlurl <url or id> download a YouTube video by url or video id.
playurl <url or id> play a YouTube video by url or id.
all or * - play all displayed items.
repeat <number(s)> - play and repeat the specified items.
shuffle <number(s)> - play specified items in random order.
>>>>>>Help Topics<<<<<<<
> help dl-command
Download Using A Custom Application
Use set download_command <command> to specify a custom command to use for
downloading.
mps-youtube will make the following substitutions:
%u - url of the remote file to download
%d - download directory as set in DDIR in mps-youtube config
%f - filename (determined by title and filetype)
%F - full file path (%d/%f)
for example, to download using aria2c (http://aria2.sourceforge.net), enter:
set download_command aria2c --dir=%d --out=%f %u
Note that using a custom download command does not support transcoding the
downloaded file to another format using mps-youtube.
>>>>>>Help Topics<<<<<<<
> help encode
Encoding to MP3 and other formats
Enter encoders to view available encoding presets
Enter set encoder <number> to apply an encoding preset for downloads
This feature requires that ffmpeg or avconv is installed on your system and is
available in the system path.
The encoding presets can be modified by editing the text config file which
resides at:
C:\Documents and Settings\HNIC\Application Data\mps-youtube\transcode
>>>>>>Help Topics<<<<<<<
>playlists
Using Local Playlists
add <number(s)> - add items to the current playlist.
add <number(s)> <playlist> - add items to the specified playlist.
(<playlist> will be created if it doesn't already exist)
vp - view current playlist.
ls - list saved playlists.
mv <old name or ID> <new name> - rename a playlist.
rmp <playlist_name or ID> - delete a playlist from disk.
open <name or ID> - open a saved playlist as the current playlist.
play <name or ID> - play a saved playlist directly.
view <name or ID> - view a playlist (current playlist left intact).
save or save <name> - save the displayed items as a playlist.
rm <number(s)> - remove items from displayed results.
sw <number>,<number> - swap two items.
mv <number>,<number> - move item <number> to position <number>.
>>>>>>Help Topics<<<<<<<
> help invoke
Invocation
All mpsyt commands can be entered from the command line. For example;
mpsyt dlurl <url or id> to download a YouTube video by url or id
mpsyt playurl <url or id> to play a YouTube video by url or id
mpsyt /mozart to search
mpsyt //best songs of 2010 for a playlist search
mpsyt play <playlist name or ID> to play a saved playlist
mpsyt ls to list saved playlists
For further automation, a series of commands can be entered separated by
commas (,). E.g.,
mpsyt open 1, 2-4 - play items 2-4 of first saved playlist
mpsyt //the doors, 1, all -a - open YouTube playlist and play audio
If you need to enter an actual comma on the command line, use ,, instead.
>>>>>>Help Topics<<<<<<<
> help config
Configuration
set - view current configuration
set <item> default - set an item to its default value
set all default - restore default settings
set checkupdate true|false - check for updates on exit
set colours true|false - use colours in display output
set columns <columns> - select extra displayed fields in search results:
(valid: views comments rating date user likes dislikes category)
set ddir <download direcory> - set where downloads are saved
set download_command <command> - type help dl-command for info
set encoder <number> - set encoding preset for downloaded files
set fullscreen true|false - output video content in full-screen mode
set max_res <number> - play / download maximum video resolution height
set notifier <notifier app> - call <notifier app> with each new song title
set order <relevance|date|views|rating> search result ordering
set user_order <<nothing>|relevance|date|views|rating> user upload list
result ordering, leave blank for the same as order setting
set overwrite true|false - overwrite existing files (skip if false)
set player <player app> - use <player app> for playback
set playerargs <args> - use specified arguments with player
set search_music true|false - search only music (all categories if false)
set show_mplayer_keys true|false - show keyboard help for mplayer and mpv
set show_status true|false - show status messages and progress
set show_video true|false - show video output (audio only if false)
set window_pos <top|bottom>-<left|right> - set player window position
set window_size <number>x<number> - set player window width & height
set api_key <key> - use a different API key for accessing the YouTube Data API
>>>>>>Help Topics<<<<<<<
> help tips
Advanced Tips
Use -w, -f or -a with your choice to override the configured setting and
play items in windowed, fullscreen or audio modes. E.g., 1-4 -a
When specifying columns with set columns command, append :N to set width.
E.g.: set columns date views user:17 likes
When using open, view or play to access a local playlist, you can enter
the first few characters instead of the whole name.
Use 5- to select items 5 upward and -5 to select up to item 5. This can be
included with other choices. e.g., 5,3,7-,-2
You can use spaces instead of commas: 5 3 7- -2
Reversed ranges also work. eg., 5-2
dump - to show entire contents of an opened YouTube playlist.
(useful for playing or saving entire playlists, use undump to undo)
set player mpv or set player mplayer - change player application
Use 1 and 0 in place of true and false when using the set command
>>>>>>Help Topics<<<<<<<
> help new
New Features in v0.2.2
- Display playing resolution / bitrate in status line (Brebiche38)
- Skip to previously played item (ids1024)
- Enable custom keymap using mplayer/mpv input.conf file (ids1024)
- Enable custom downloader application (ids1024 & np1)
>>>>>>Help Topics<<<<<<<
default settings
Key Value
api_key : AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo
checkupdate : True
colours : True
columns :
ddir : C:\Documents and Settings\user\Downloads\mps
download_command :
encoder : 0 [None]
fullscreen : False
max_res : 2160p
notifier :
order : relevance
overwrite : True
player : mplayer.exe
playerargs :
search_music : True
show_mplayer_keys : True
show_status : True
show_video : False
user_order :
window_pos :
window_size :
Enter: set <key> <value> to change
Enter: set all default to reset all
>