youtube-dl example

youtube-dl (available for UNIX/Windows) is probably my most-often used Python script. Copy/paste a YouTube URL (or any other supported website URL) and youtube-dl downloads the video locally. Incredibly handy especially when you hate buffering and would rather download something to watch it later (including whole playlists!).

After you install it, you can specify your settings in its .conf file at ~/.config/youtube-dl/config. My settings are below:

-f bestvideo[ext=mp4]+bestaudio --no-playlist

The “bestvideo” flag downloads the source video at its best format (1080p usually or 4k if available) as well as downloading the “bestaudio” source available as well. The “–no-playlist” option downloads only the video if the video is in the middle of a playlist but will download an entire playlist if you give it the playlist’s root URL. You can completely customize your settings as well like lowering the video resolution so that videos don’t take as long to download.

Here’s the syntax to use when downloading:

youtube-dl ""


This command copies a file from your machine over SSH to a remote machine. Quotation marks are included to escape the folder name that has a space in it. Add -rp if you need to copy a directory:

  • -r means recursive
  • -p preserves modification times, access times, and modes from the original file
scp -rp /path/to/file-or-directory/ username@%hostname%:"/path\ to/destination"