Skip to content

Instantly share code, notes, and snippets.

@silveraid
Last active February 8, 2019 17:11
Show Gist options
  • Save silveraid/d0b7b29d9010b623addc383afd1426b2 to your computer and use it in GitHub Desktop.
Save silveraid/d0b7b29d9010b623addc383afd1426b2 to your computer and use it in GitHub Desktop.
Simple tool to automate fetching videos on MacOSX from YouTube
#!/bin/bash
# Simple tool to automate fetching videos on MacOSX from YouTube
# Installing dependencies:
# pip install youtube-dl
# brew install libav
echo "Resetting clipboard ..."
echo "-" | pbcopy
while [ true ]; do
echo -n "Waiting for URL ..."
url="-"
while [ "${url}" == "-" ]; do
echo -n "."
sleep 1
url=$(pbpaste)
done
echo "!"
# calling youtube-dl
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4 ${url}
# resetting clipboard
echo "-" | pbcopy
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment