Skip to content

Instantly share code, notes, and snippets.

@Madh93
Last active November 28, 2016 22:07
Show Gist options
  • Save Madh93/6d5e6267ab41f9e4c6e60c691641cb8f to your computer and use it in GitHub Desktop.
Save Madh93/6d5e6267ab41f9e4c6e60c691641cb8f to your computer and use it in GitHub Desktop.
Get 1080p Youtube videos (or best available quality)
#! /bin/bash
# Requirements: youtube-dl (https://github.com/rg3/youtube-dl/)
if [ -n "$(youtube-dl --version)" ]; then
format=`youtube-dl -F "$1"`
if [ -n "$(echo "$format" | cut -d " " -f1 | grep 299)" ]; then
youtube-dl -f 299+140 "$1"
elif [ -n "$(echo "$format" | cut -d " " -f1 | grep 298)" ]; then
youtube-dl -f 298+140 "$1"
elif [ -n "$(echo "$format" | cut -d " " -f1 | grep 137)" ]; then
youtube-dl -f 137+140 "$1"
else
youtube-dl -f best "$1"
fi
else
echo "youtube-dl not found"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment