Jump to content

Youtube Downloader (Based on youtube-dl)

Recommended Posts



First i would like to thank David Ferguson and Subject22 for their help.


The following Workflow automatic downloads the Youtube video which is opened in your Browser. To do this, the workflow made use of  the Python Script 'youtube-dl' developed by RICARDO GARCIA GONZALES and his Team. Here is the link to their project site: http://rg3.github.io/youtube-dl/index.html


I use this command line script since several month and it is fantastic, because it downloads a movie in the highest available qualitiy. Nothing more, nothing less. And the best - it supports...


YouTube.com, metacafe.com, Google Video, Photobucket videos, Dailymotion, DepositFiles, blip.tv, vimeo, myvideo.de, The Daily Show / Colbert Nation, The Escapist, CollegeHumor, arte.tv, Soundcloud, xvideos, infoq, mixcloud, Stanford Open Content, Youku, MTV, XNXX, Google Plus, A generic downloader that works in some sites


To download a video just open a youtube site in your browser and start the Workflow with the keyword. It is not necessary to view the video during the download, it can be paused. The download itself begins immediately and is finished if the final notification says so. The filename and the file extension of the downloaded video file is generated from the youtube-dl script. When finished the video resides on your Desktop.


Sorry, but until the reported problem with the AllInOne workflow can be fixed, i will post the single versions. ;(


Google Chrome




2013-04-15: Split the AllInOne workflow to single ones

2013-04-12: Support for Safari, Google Chrome, Firefox, Webkit, Opera, Google Chrome Canary

2013-04-12: Pick the url from the frontmost browser

2013-04-12: Error Handling and Notifications

Edited by Efty Edge
Link to comment

Personally, I think cclive is a superior downloader, but yes, most people may prefer youtube‐dl (I think it’s more popular).

Also, I don’t known if you’re interested, but I solved the “pick a browser” issue with PinAdd, in case you want to implement it, or want to some help to do it. It currently supports Chrome, Chrome Canary, Safari, and Webkit. You need an extra step (only the first time) to configure it, but it’s easier for you to maintain just one script.

If you’re interested, take a look at the code (lines 16 through 30 are the relevant ones).

Edited by Vítor
Link to comment

Hi Vitor.


If you like, feel free to do the changes. Any help or idea is welcome!  :D


I must confess, that i'm a real applescript newbie and this small script above are more the 10 hours of work.

But i'm really sure, that with the help in this forum i can get even better.


Good night from Germany


Link to comment

I'm a real applescript newbie and this small script above are more the 10 hours of work.


I know the feeling, applescript always makes me hate the time I spend with it. If you work better with something like bash, what I recommend is that you do most of your script with it, and when you need applescript call it by doing

osascript -e '<applescript_code_here>'
Link to comment

I'm sorry but I don't know how I can make this work with any other browser than Safari. How can I do that?


Looking at the code, it seems it will act depending on what browser you are currently viewing. Simply put, if the browser is not your frontmost app, it will not work.

Link to comment

I think due to how the workflow operates, you may be leaving youtube too soon. The problem is that when it says “Download Started… Watch your desktop”, the download has in fact not yet started, and if you switch to your desktop (or close the tab), you’ll miss it.


Here’s how the workflow works.

1. You call the workflow by typing “yd”.

2. The workflow outputs a message, saying the download started.

3. Some applescript code runs to identify your frontmost browser.

4. If it succeeds, it’ll ask your browser for the url of the frontmost tab.

5. “youtube‐dl” is called, and the download starts.


So try calling the workflow, and then waiting a while without doing anything, to see if it works. It’s not ideal, and there should probably be a setting to define the browser instead of trying to guess it, which would make it faster.


Also bear in mind, firefox users, that there’s no good way to get the URL via applescript in firefox, only hacky ways (sending keystrokes to copy it), which can be very error prone.

Edited by Vítor
Link to comment

Hi Vitor.


You are right, the firefox part is a little bit tricky, but there is no direct applescript support. But on my MBPR it works flawless. 


By the way - the last hours i tried to reproduce the error but i can't. I've no idea whats the reason!?


Maybe anyone else had an idea. ;)



Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...