Skip to content

Instantly share code, notes, and snippets.

@deanishe
Created March 2, 2015 20:00
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save deanishe/5581a6f4dde2616f89ab to your computer and use it in GitHub Desktop.
Save deanishe/5581a6f4dde2616f89ab to your computer and use it in GitHub Desktop.
Open Current YouTube Video in QuickTime Player (or whatever)
#!/bin/bash -e
# Instead of watching YouTube videos in your browser, stream them in
# QuickTime Player (or VLC/MPlayer etc.)
#
# youtube-dl supports hundreds of websites, so it will probably work
# for a lot of video sites.
# See https://rg3.github.io/youtube-dl/
# Get URL of current tab in browser
# Google Chrome
webpage_url=$(osascript -e 'tell application "Google Chrome" to return URL of active tab of front window')
# Safari
# webpage_url=$(osascript -e 'tell application "Safari" to return URL of front document')
stream_url=$(/usr/local/bin/youtube-dl -g "${webpage_url}")
# Open the stream URL in QuickTime Player. Change to your preferred application.
open -a "QuickTime Player" "${stream_url}"
@KoStard
Copy link

KoStard commented Apr 17, 2018

How to make .sh files open as a app (instead of opening in Xcode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment