Jump to content
dustying

Open Videos in Quicktime

Recommended Posts

I love watching videos (particularly youtube) in quicktime. I do this by:

 

  • I use the ClickToFlash extension for Safari
  • That lets me right click on a playing youtube video (in the HTML 5 video player) and I can (usually) click "copy video address"
  • Open quick time
  • Click "Open Location" (Command-L)
  • Paste the link (the video address)

Quicktime opens the video in its own window. No ads, no distractions, super quick, keep the quicktime window above other windows, etc. 

I'd love to have an extension that automates all of that. And then make that a universal hotkey (control-option-command-w or something) so that I can just press that hotkey on a youtube page and it opens in quicktime (and closes the youtube tab). I tried doing it with Automator too, but couldn't figure it out. Even if that were possible and then just trigger that Automator action with a hotkey would be great.

 

Thanks!

Edited by dustying

Share this post


Link to post

Damn! This is a sweet way to watch YouTube videos.
 
This is actually pretty simple to do, but you need youtube-dl (which is what that DownVid workflow uses).
 
Assuming you installed youtube-dl to /usr/local/bin as the instructions say, the following will grab the URL of the frontmost tab in Chrome and open the corresponding stream in QuickTime Player (paste it into a Run Script action with Language /bin/bash in an Alfred Workflow then connect it to whatever hotkeys/keywords you want): 

webpage_url=$(osascript -e 'tell application "Google Chrome" to return URL of active tab of front window')
video_url=$(/usr/local/bin/youtube-dl -g "${webpage_url}")
open -a "QuickTime Player" "${video_url}"

If you use Safari, use this instead:

webpage_url=$(osascript -e 'tell application "Safari" to return URL of front document')
video_url=$(/usr/local/bin/youtube-dl -g "${webpage_url}")
open -a "QuickTime Player" "${video_url}"

Note: it takes several seconds for the workflow to run (while youtube-dl figures out the stream URL).

Share this post


Link to post

Total newb to terminal/command line, but finally got this working, thanks!

 

EDIT: Ok, it's working great, even on some pages that just have a youtube video embedded. But, it hasn't done this before using this script: the video keeps playing but the audio drops out, like it's buffering poorly. The buffer progress bar isn't as consistent before using this script too, it doesn't really indicate it's buffering until the whole video plays.

Normal?

Edited by dustying

Share this post


Link to post

In all likelihood, that doesn't have anything to do with what you're doing. There's just a dodgy connection to YouTube.com.

 

You could try making sure youtube-dl is up to date by running youtube-dl --update in Terminal.

Share this post


Link to post

DownVid’s author, here. Using it, you can add video URLs directly to WatchList1 which will make it easy to watch and manage those videos later. It’ll also get the subtitles from the youtube videos, which is a recent addition.
 
You do, however, ask how to watch the videos now. I’ve long thought about adding that to DownVid, and a similar option to WatchList for which an important part of the structure is already in place. The biggest hurdle to this is how to make it work with multiple video players, as the user might have any from a multitude. That said, I’ll probably just end up limiting it to a select few.
 
Here is, then, my recommendation to fix your issue right now: if you dump QuickTime Player for mpv, you can simply do mpv "{{youtube_url_here}}". Done. Following deanishe’s instructions, you’d simply replace the last two lines with mpv "${video_url}".
 
Glad to see you got it working with QuickTime Player, but I’d still recommend trying with mpv, as perhaps that will solve your issues.
 
----------
 
1 I’ve also made that and was not necessarily going to mention it, but since you found DownVid, I thought I might expand on it.

Share this post


Link to post

I think you'd need to use /usr/local/bin/mpv, not just mpv, as /usr/local/bin won't be on your path in a workflow.

 

(At least if you install via Homebrew. No idea where the default installer puts the mpv executable.)

Edited by deanishe

Share this post


Link to post

Yes, depending on how you do it; if you’re just building the workflow for yourself, you might even be able to just drop the binary there. Alternatively, we can return to your suggestion and modify it a bit: open -a "mpv" "${video_url}".

Share this post


Link to post

Yes, depending on how you do it; if you’re just building the workflow for yourself, you might even be able to just drop the binary there. Alternatively, we can return to your suggestion and modify it a bit: open -a "mpv" "${video_url}".

 

I gave mpv a try. This is a much better way to run it than via the CLI program: open will exit immediately, but if you use /usr/local/bin/mpv, the script won't exit till the app exits. Which sucks if you're using FastScripts or the like.

Edited by deanishe

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...