Skip to content

Instantly share code, notes, and snippets.

@erjiang
Created October 20, 2015 20:38
Show Gist options
  • Save erjiang/49606f7ac3ddcf43e3e5 to your computer and use it in GitHub Desktop.
Save erjiang/49606f7ac3ddcf43e3e5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# copied from https://github.com/exogen/dotfiles/blob/730fb8e2b72b2fc3aa3d90b889874bb5195e1d07/.profile#L65
# Skip DASH manifest for speed purposes. This might actually disable
# being able to specify things like 'bestaudio' as the requested format,
# but try anyway.
# Get the best audio that isn't WebM, because afplay doesn't support it.
# Use "$*" so that quoting the requested song isn't necessary.
youtube-dl --default-search=ytsearch: \
--youtube-skip-dash-manifest \
--output="${TMPDIR:-/tmp/}%(title)s-%(id)s.%(ext)s" \
--restrict-filenames \
--format="bestaudio[ext!=webm]" \
--exec=mplayer "$*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment