🖥️youtube-dl

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the youtube-dl command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#    ██╗   ██╗ ██████╗ ██╗   ██╗████████╗██╗   ██╗██████╗ ███████╗██████╗ ██╗     
#    ╚██╗ ██╔╝██╔═══██╗██║   ██║╚══██╔══╝██║   ██║██╔══██╗██╔════╝██╔══██╗██║     
#     ╚████╔╝ ██║   ██║██║   ██║   ██║   ██║   ██║██████╔╝█████╗  ██║  ██║██║     
#      ╚██╔╝  ██║   ██║██║   ██║   ██║   ██║   ██║██╔══██╗██╔══╝  ██║  ██║██║     
#       ██║   ╚██████╔╝╚██████╔╝   ██║   ╚██████╔╝██████╔╝███████╗██████╔╝███████╗
#       ╚═╝    ╚═════╝  ╚═════╝    ╚═╝    ╚═════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝
                                                                                             
                                                                                                                                                

# To download a video in 720p MP4:
youtube-dl -f 22 example.com/watch?v=id

# To download a video in 720p MP4 or WebM or FLV:
youtube-dl -f 22/45/120

# To list all available formats of a video:
youtube-dl -F example.com/watch?v=id

# To download a video to /$uploader/$date/$title.$ext:
youtube-dl -o '%(uploader)s/%(date)s/%(title)s.%(ext)s' example.com/watch?v=id

# To download a video playlist starting from a certain video:
youtube-dl --playlist-start 5 example.com/watch?v=id&list=listid

# To simulate a download with youtube-dl:
youtube-dl -s example.com/watch?v=id

# Get playlist for Livestream on YouTube
youtube-dl --list-formats <URL>; youtube-dl -f <STREAM_ID> -g <URL>

# Get YT autogen subtitles
youtube-dl --write-auto-sub -f 139 -o subtitles CUdwDEKlDrw; grep '<c.color' subtitles.en.vtt|sed 's/<[^>]\+>//g' 

# For all video formats see
# http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs

# I have a text file with a song and artist on each line. I would like to make a script that would insert each line from the text file, insert it in the command below, and then repeat until the end of the file. edited for clarity
youtube-dl -f 'bestaudio[ext=m4a]' "ytsearch1:INSERT TEXT HERE"

# Try...# This should print out all of your listed items.
while read item; do
  echo "$item"
done < song_list.txt

# Now, alter it by asking it to perform the youtube-dl instead of displaying...
while read item; do
  youtube-dl -f 'bestaudio[ext=m4a]' "ytsearch1:$item"
done < song_list.txt

# D/l from youtube
youtube-dl 'https://www.youtube.com/watch?v=CnDUZCtALWI'

youtubeuploader -title "5 hours of fishbowl" -description "fish, for 5 hours" -limitBetween 09:00-17:00 -ratelimit 2000 -filename fish.webm 
# You've probably heard of youtube-dl. Well there's also youtubeuploader, which can rate limit upload speed.

# Listen to a song from youtube with youtube-dl and mpv - Explanation Firstly the function checks if user gave it any input, and notifies the user if they failed to do so. If user has inputed a search string, the function will call upon youtube-dl to find url of the audio of the first matching youtube video and play that with mpv. Call function by wrapping search string in quotes: listen-to-yt "sultans of swing" You have to paste the line in your .zshrc and source .zshrc for it to work. Limitations The dependancies are youtube-dl and mpv. 
function listen-to-yt() { if [[ -z "$1" ]]; then echo "Enter a search string!"; else mpv "$(youtube-dl --default-search 'ytsearch1:' \"$1\" --get-url | tail -1)"; fi }

    

#==============================##==============================#
# CMD YOUTUBEDL						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░