
-------------------------
youtube-dl
-------------------------
https://youtube-dl.org/
https://wiki.archlinux.org/index.php/Youtube-dl

Suppoerted Websites
--------------------
	https://github.com/ytdl-org/youtube-dl/blob/master/docs/supportedsites.md

Install
-------------
	$ sudo pacman -S youtube-dl ffmpeg
	
	youtube-dl
	----------
	youtube-dl is a command-line program that lets you easily download videos and audio from more than a thousand websites.	
	
	ffmpeg
	-----
	FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video

Config(optional)
---------------
	$ sudo nano ~/.config/youtube-dl/config
	
	# Default download location
	-o ~/Downloads/%(title)s.%(ext)s
	
Getting help
------------
	$ youtube-dl --help
	
Get/Check Available formats
-------------
	$ youtube-dl -F <url>
	$ youtube-dl --list-formats <url>

Download video/audio or playlist
--------------------------
	video
	-----
	$ youtube-dl <url>
	$ youtube-dl <url-1> <url-2> <url-3>
	
	audio (default Ogg (opus) extension)
	-----
	$ youtube-dl -x <url>
	$ youtube-dl -x <url-1> <url-2> <url-3>

Download given format
----------------------
	given extension
	---------------
	$ youtube-dl -f mp4 <url>
	$ youtube-dl -x --audio-format mp3 <url>
	
	given format code
	-----------------
	$ youtube-dl -f 160 <url>
	
Download with given path/to/filename
------------------------------------
	$ youtube-dl -x --audio-format mp3 -o '~/Music/%(title)s.%(ext)s' <url>	
	
Filename - title/uploader name/channel name/upload date
--------------------------------------------------------
	$ youtube-dl -o '%(title)s by %(uploader)s on %(upload_date)s in %(playlist)s.%(ext)s' <url>
	
Download all URLs in a text file
-------------------------------
	~/Music/youtube-urls.txt :-
	
	<url-1>
	<url-2>
	<url-3>
	<url-4>
	<url-5>
	
	$ youtube-dl -a ~/Music/youtube-urls.txt
	
Download videos in certain quality and/or format
------------------------------------------------	
	[#] best - Select the best quality format of the given file with video and audio.
	[#] worst - Select the worst quality format (both video and audio).
	[#] bestvideo - Select the best quality video-only format (e.g. DASH video). Please note that it may not be available.
	[#] worstvideo - Select the worst quality video-only format. May not be available.
	[#] bestaudio - Select the best quality audio only-format. May not be available.
	[#] worstaudio - Select the worst quality audio only-format. May not be available.
	
	audio-only with best quality.
	--------------
	$ youtube-dl -f bestaudio <url>
	
	1 file with 2 different qualities combined
	--------------	
	$ youtube-dl -f bestvideo+bestaudio <url>
	
	2 files with 2 differnat qualities
	--------------
	$ youtube-dl -f 'bestvideo,bestaudio' <url>
	
	given quality with specific resolution
	--------------------------------------
	$ youtube-dl -f 'bestvideo[height<=720]' <url>
	$ youtube-dl -f 'bestvideo[height<=720]+bestaudio[height<=720]' <url>
	$ youtube-dl -f 'bestvideo[height<=720],bestaudio[height<=720]' <url>
	
	given quality with given format/extention
	------------------------------------------
	$ youtube-dl -f 'bestvideo[ext=mp4],bestaudio[ext=m4a]' <url>
	
	if not available, go for the next
	---------------------------------
	$  youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' <url>
	
Set size limit for videos
-------------------------
	$ youtube-dl --min-filesize 100M <playlist_url>
	$ youtube-dl --max-filesize 500M <playlist_url>
	$ youtube-dl -f 'bestvideo[filesize<200M]' <url>
	
Download videos by date-wise
----------------------------
	download videos uploaded at an exact date - October 01, 2018
	------------------------------------------------------------
	$ youtube-dl --date 20181001 <URL>
	
	Download videos uploaded on or before October 01, 2018
	------------------------------------------------------
	$ youtube-dl --datebefore 20180101 <URL>
	
	Download videos uploaded on or after October 01, 2018
	------------------------------------------------------
	$ youtube-dl --dateafter 20180101 <URL>
	
	Download only the videos uploaded in the last 6 months
	------------------------------------------------------
	$ youtube-dl --dateafter now-6months <URL>
	
	Download videos between January 01, 2018 and January 01, 2019 
	--------------------------------------------------------------
	$ youtube-dl --dateafter 20180101 --datebefore 20190101 <URL>

Download specific videos from playlist
-------------------------------------
	Download the 10th file from a playlist
	-------------------------------------
	$ youtube-dl --playlist-items 10 <playlist_url>
	
	Download multiple random files
	-----------------------------
	$ youtube-dl --playlist-items 2,3,7,10 <playlist_url>
	
	Download a video playlist starting from 10 to end
	-------------------------------------------------
	$ youtube-dl --playlist-start 10 <playlist_url>
	
	Download only the files starting from 2nd to 5th in a playlist
	-------------------------------------------------------------
	$ youtube-dl --playlist-start 2 --playlist-end 5 <playlist_url>
	
Download only videos suitable for specific age
---------------------------------------------
	$ youtube-dl --match-title "let's play" --age-limit 7 --reject-title "nsfw" <playlist_url>
	
Set download speed limit
------------------------
	$ youtube-dl -r 50K <URL>
	
Resume downloads
----------------
	$ youtube-dl  -c  <URL>
