Created
March 2, 2015 20:00
-
-
Save deanishe/5581a6f4dde2616f89ab to your computer and use it in GitHub Desktop.
Open Current YouTube Video in QuickTime Player (or whatever)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to make .sh files open as a app (instead of opening in Xcode)