Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jmantn

macrumors 6502a
Original poster
Mar 13, 2012
513
157
Tn
I'm completely new to some of this and need help. I've downloaded Python 3.4.2 from python.org/downloads/ and installed YouTube-dl from rg3.github.io/youtube-dl/download.html.

I've created an Automator service that receives selected URL's in Safari where the input is only URL's and created a Run Shell Script Where shell is Bin/Bash and have the following code:

Code:
cd ~/Downloads
for f in "$@"
do
    youtube-dl -x -o "% s.% s" --all-subs -- "$f" 
done

When I pull up any youtube video as I tried multiple and I have the url selected and go to safari and to services and the name of the service I created and click on it nothing happens. No error message, no downloads in my download folder, nothing happens.

I'm pretty lost and unsure if I even need to be using the bin/bash or if I'm so far off base it's laughable however I haven't found much in regards to this for yosemite except for the following three links:
http://nachithree.org/argelia/2015/01/20/youtube-dl-automator-service-in-yosemite/

http://stackoverflow.com/questions/26560841/youtube-dl-automator-service-in-yosemite

http://www.izinc.net/post/83610810824/download-any-youtube-video-from-osx


However none of those examples has worked for me yet.
 
There was no need to download Python 3.4.2 to use this. Where did you install it e.g. the path where it is located? Do you really need to use the -x option to extract the audio? The documentation states that this option requires ffmpeg or avconv and ffprobe or avprobe. If you don't have these installed using that option will result in an error. Start with something simple from the command line e.g. open the Terminal application and try to download one of your URLs.
Look at the -s option under Verbosity / Simulation Options in the documentation to simulate what is going to happen without downloading the video and writing anything to disk. Here's the output of a simple example test:

Code:
Billys-Mac-Pro:~ kryten$ youtube-dl -o '/Users/kryten/Downloads/%(title)s.%(ext)s' https://www.youtube.com/watch?v=kjiVt07EJhM&spfreload=10
[1] 1341
Billys-Mac-Pro:~ kryten$ [youtube] kjiVt07EJhM: Downloading webpage
[youtube] kjiVt07EJhM: Extracting video information
[youtube] kjiVt07EJhM: Downloading DASH manifest
[download] Destination: /Users/kryten/Downloads/Apple Campus 2 December update.mp4
[download] 100% of 48.42MiB in 00:14

[1]+  Done                    youtube-dl -o '/Users/kryten/Downloads/%(title)s.%(ext)s' https://www.youtube.com/watch?v=kjiVt07EJhM

Things you can do in Automator to test before creating a service :

Make a workflow with the following actions :

  1. Get Current Webpage from Safari or Get Specified URLs
  2. Run Shell Script

Note : Tested on Mavericks - Python 2.7.5
 

Attachments

  • Screen Shot -1-2015-01-31.png
    Screen Shot -1-2015-01-31.png
    78.3 KB · Views: 709
  • Screen Shot -2-2015-01-31.png
    Screen Shot -2-2015-01-31.png
    67.8 KB · Views: 750
Last edited:
So when I installed Phyton I installed to the default directory within Mac. When I installed the YouTube-dl I installed to the default directory as well.

Setting up an exact workflow similar to your pictures the workflow runs and does not throw an error however nothing actually gets downloaded.

Both versions of Python (I've installed both) are showing under usr/local/bin

Where should YouTube-dl be showing? I installed using instructions on the website and used terminal and I also did the update command which came back as up to date which to me told me it was installed correctly.

Not sure why this isn't working

With the workflow process from your attached image I used the following URL to test: https://www.youtube.com/watch?v=B1y4c11rg78
and copied your shell script exactly except I put in my user name. Ran within two seconds and nothing shows up in my downloads folder.

The website I used was:http://rg3.github.io/youtube-dl/download.html

and I used this command:
To install it right away for all UNIX users (Linux, OS X, etc.), type:

Code:
sudo curl https://yt-dl.org/downloads/2015.02.04/youtube-dl -o /usr/local/bin/youtube-dl

sudo chmod a+x /usr/local/bin/youtube-dl
 

Attachments

  • Screen Shot 2015-02-05 at 5.44.37 PM.png
    Screen Shot 2015-02-05 at 5.44.37 PM.png
    110.3 KB · Views: 420
Last edited:
Setting up an exact workflow similar to your pictures the workflow runs and does not throw an error however nothing actually gets downloaded.

Not exactly. Spot the difference.

If you want to use Pass input: to stdin you could use something like this in the Run Shell Script action :

Example :

Code:
/usr/local/bin/youtube-dl -o '/Users/kryten/Downloads/Youtube/%(title)s.%(ext)s' -a -

If you want to use Pass input: as arguments you could also use something like this in the Run Shell Script action without the for loop :

Example :

Code:
/usr/local/bin/youtube-dl -o '/Users/kryten/Downloads/Youtube/%(title)s.%(ext)s' "$@"
 

Attachments

  • Screen Shot 2015-02-06.png
    Screen Shot 2015-02-06.png
    23.8 KB · Views: 396
Last edited:
Wow nice catch. Sadly I haven't used Automator much as every time I see a great workflow they've been outdated by Mavericks or Yosemite and as a new father haven't had much time to just play around like I'd like.

Thank you for the help and keen eye!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.