Jump to content

DownMedia — Download media from popular sources


Recommended Posts

Download media from a plethora of sources, even when embedded in other pages.


The main commands are dv to download video and da to download audio (often extracted from a video source). Both will present you with two download options, if available: the URL of your frontmost browser tab, and the URL in your clipboard.


CNaS35s.png


Run any option with the ⌘ modifier, and the full playlist will be downloaded. Use ⌥ and it will toggle adding to WatchList (a separate Workflow).


Notifications will appear on download start and end.


GUr5P3y.png


To see auto-refreshing download progress, run dp. Actioning it with ⌘ will restart the current download (readding to the end of the queue), while actioning with ⌃ will abort.


fZVsx3B.png


:downmediaservices installs (or later removes) DownMedia actions to macOS Services. This allows you to right click a URL and download from the context menu.


gYqEcvb.png


The Workflow Environment Variables represent the directory to download to, the audio format to save when using da, and the default behaviour of adding a download to WatchList (true or false).

 

Download | Source

 

If on Alfred 3, download this one (works differently).

 

If you have an issue, follow the guide for an effective bug report.

Works well with
WatchList

Edited by vitor
Link to post
  • Replies 347
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Download media from a plethora of sources, even when embedded in other pages. The main commands are dv to download video and da to download audio (often extracted from a video source). Bot

Update. Added support to download audio. It also works with downloading a full playlist as audio, but it does not include and option to add to WatchList automatically due to a limitation in yo

It by default downloads the best quality version available, so it will download different formats for different videos.   That said, yes, it’s very easy to do what you want. On the workflow, double‐

Posted Images

This workflow gets a URL from your clipboard, and uses youtube‐dl to download the main video (supports youtube and others) to your Desktop, with the highest quality possible.

Copy a link to your clipboard, run “dv”, and you’re done.

wltW4Am.png

It’ll show you a notification when it starts downloading, and another one when it’s finished.

Wait, why don’t you get the URL from my browser’s open tab, instead of having me copy it?

Well, that is actually how this worked, and I scrapped that version not even an hour ago, at the time of this post. Seriously, and if you prefer that version, just ask and I’ll give you a download link — it’s working fully (albeit with limited testing). What happened is that while using it naturally, I’ve realised that it’s counter‐intuitive, at least to the way I need it to work. With PinAdd (that served as the base for the previous version), I usually run the script after I’ve seen the page, but with videos I’ll run it before, and I’ve realised most of the time I won’t even open the page, I just right‐click and copy a link, so this actually works better with that method.

Here’s how it looks.

zOAoiuT.png

Download

https://github.com/vitorgalvao/alfred-workflows/raw/master/bin/DownVid.alfredworkflow

Source

https://github.com/vitorgalvao/alfred-workflows/tree/master/DownVid

License

I don’t care, do whatever you want with this. If you make any changes that could benefit the script, I’d certainly appreciate if you’d share them (perhaps I could incorporate them), but it’s not at all required.

Youtube‐dl’s license is very permissive (essentially public domain), which is the main reason I’ve picked it — it’s very similar to mine, which means that if you want to make any changes to this workflow in part or in whole and redistribute it, you’re absolutely free to do so, you don’t even have to credit anything or anyone.

Is there a youtube downloader for audio only workflow? I searched but couldn't find one.
Link to post

Is there a youtube downloader for audio only workflow? I searched but couldn't find one.

 

You can change this one pretty easily to do that, as youtube‐dl supports a --extract-audio option. If you need any help doing that, I can point you in the right direction.

Link to post

Here are the instructions on how to change this workflow to get the audio from videos, instead of (or in addition to) the video.

I warn you that it may be a lengthy process (it’s not difficult, it just takes a while, specially if you do not have some things installed).

youtube-dl uses ffmpeg to extract the audio, so you likely need to install it, but I cover that in the instructions.

1. Open a terminal.
2. Install homebrew (if you don’t have it). It might ask you to install XCode’s CLI tools.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3. Install ffmpeg (again, if you don’t have it) by running

brew install ffmpeg

4. After it finishes, you can close the terminal.
5. Open the workflow, and after that double-click the topmost “Run Script” node.
6. At the top of the code that appears, paste this

export PATH="/usr/local/bin:$PATH"

7. Now you’ll have to make a choice. Keep in mind that it’ll still download the video, but it’ll then extract the audio from it and delete the video (or not, that’s the choice).
8. If you want to always download only the audio, change (a few lines under getfile() {)

python youtube-dl --no-playlist --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"

to 

python youtube-dl --extract-audio --no-playlist --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"

If you want to keep both the audio and video, change it to

python youtube-dl --extract-audio --keep-video --no-playlist --newline --output "${downdir}/%(title)s.%(ext)s" "${link}" > "${progressfile}"

9. You can now save. You’re done.

Steps 2 and 3 can take some time, particularly 3 since it will download and compile from source (ffmpeg can take some time).

If you have any difficulty with any of the steps, please state what problems you’re having, and we can work from there.

Edited by Vítor
Link to post

I think I will just convert the video with osx built in encoder. Definitely faster.

 

I disagree. If that’s the kind of thing you do so often that you want a workflow, that doing it that way is definitely slower.

The method I’ve outlined takes longer to setup, granted, but you only have to do that once, and in the long run it’s way faster, if only because it’ll be a one step process with a single keyword, instead of a multiple step process where you have to type the keyword, wait for it to download (which varies from video to video), start another process to convert it, wait for that to finish, and delete the video. It’s a small tedious process multiple times, versus a big tedious process once.

Perceived speed is often better than actual speed, psychologically (if only to us, users of software like Alfred). “Set it and forget it” is arguably the better option — that is why workflows are great.

Edited by Vítor
Link to post

I disagree. If that’s the kind of thing you do so often that you want a workflow, that doing it that way is definitely slower.

The method I’ve outlined takes longer to setup, granted, but you only have to do that once, and in the long run it’s way faster, if only because it’ll be a one step process with a single keyword, instead of a multiple step process where you have to type the keyword, wait for it to download (which varies from video to video), start another process to convert it, wait for that to finish, and delete the video. It’s a small tedious process multiple times, versus a big tedious process once.

Perceived speed is often better than actual speed, psychologically (if only to us, users of software like Alfred). “Set it and forget it” is arguably the better option — that is why workflows are great.

After setting it up what do you have to every time for the workflow to work?

I don't DL YouTube vids often so i could just use your workflow, then convert natively I guess.

Link to post

After setting it up what do you have to every time for the workflow to work?

 

Nothing, that is the point. If you follow my instructions you’ll end up with a modified version of this workflow. You then just need to call it, and it’ll do everything — download the video and get the audio.

Link to post

Nothing, that is the point. If you follow my instructions you’ll end up with a modified version of this workflow. You then just need to call it, and it’ll do everything — download the video and get the audio.

Nothing, that is the point. If you follow my instructions you’ll end up with a modified version of this workflow. You then just need to call it, and it’ll do everything — download the video and get the audio.

From your first post I got the impression i had to do a little bit of the 13 steps after the setup. Well, ill give it a shot.
Link to post

Thank you for this amazing extension! I've followed the very detailed steps in setting up the audio extraction but I'm having trouble with it not behaving the way the downvid one works. It doesn't seem to recognize that there is something in the clipboard (i.e. doesn't let me hit enter after entering the keyword).

 

Any help would be appreciated!  Thanks again!

Link to post

Thank you for this amazing extension! I've followed the very detailed steps in setting up the audio extraction but I'm having trouble with it not behaving the way the downvid one works. It doesn't seem to recognize that there is something in the clipboard (i.e. doesn't let me hit enter after entering the keyword).

 

Any help would be appreciated!  Thanks again!

 

If it doesn’t let you hit enter (as opposed to letting you do it but just not downloading the file), then check the script filter and see if the dropdown on the first line is set to “no argument”.

If you want, you can also post your workflow and I’ll take a look.

Link to post

 

If it doesn’t let you hit enter (as opposed to letting you do it but just not downloading the file), then check the script filter and see if the dropdown on the first line is set to “no argument”.

If you want, you can also post your workflow and I’ll take a look.

Thanks for your response! The "no argument" worked, but I'm now not getting audio in the resulting file.

 

I've posted the workflow here. Thank you for your support!

 

http://www.dropbox.com/s/jpj79bxt0vrzrpp/DownVid%20%28Audio%29.alfredworkflow

Link to post

I think I found the issue; it was actually a problem with the instructions. What happened is that on instruction 11 I’m telling you to read youtube‐dl from a different place where I told you to save it on step 2 (likely because I’ve saved it to a different location to test it before posting the instructions, and forgot to change that).
 
I’ve updated the instructions; see step 11, it now has the corrected code.
 
If it still fails (or even if it succeeds), let me know, maybe there’s something else missing.

Link to post

I think I found the issue; it was actually a problem with the instructions. What happened is that on instruction 11 I’m telling you to read youtube‐dl from a different place where I told you to save it on step 2 (likely because I’ve saved it to a different location to test it before posting the instructions, and forgot to change that).

 

I’ve updated the instructions; see step 11, it now has the corrected code.

 

If it still fails (or even if it succeeds), let me know, maybe there’s something else missing.

Thanks for the reply! It runs the script now, but no file is put out (the notifications both come up though).

 

Sorry if this is turning into a hassle for you now!

Link to post

WOW. AMAZING! 

 

Thank you. Glad you liked it.

 

Thanks for the reply! It runs the script now, but no file is put out (the notifications both come up though).

 

Sorry if this is turning into a hassle for you now!

 

No problem. I just noticed something else, you didn’t do steps 7, 8, and 9. It has to be done as a Terminal command, not a script, or else youtube‐dl won’t do the conversion.

Link to post

Thank you. Glad you liked it.

 

 

No problem. I just noticed something else, you didn’t do steps 7, 8, and 9. It has to be done as a Terminal command, not a script, or else youtube‐dl won’t do the conversion.

It now opens the terminal, runs the command and outputs this error: python: can't open file '/usr/bin/youtube-dl': [Errno 2] No such file or directory

 
 
I'm going to completely redo it tomorrow and hopefully that'll fix it :) Thanks for your help!
Link to post

It now opens the terminal, runs the command and outputs this error: python: can't open file '/usr/bin/youtube-dl': [Errno 2] No such file or directory

 

 

I'm going to completely redo it tomorrow and hopefully that'll fix it :) Thanks for your help!

That's likely some problem with doing step 1, as that error is basically saying the file is not there.

Link to post

Thanks for your work. The workflow is downloading a *.flv can I change this to a mp4 to use with my iPhone?

And "how"? ;) Sorry.. Newbie. 

Thanks a lot.

 

It by default downloads the best quality version available, so it will download different formats for different videos.

 

That said, yes, it’s very easy to do what you want. On the workflow, double‐click the “Run Script” option, and replace the code with this one

if [[ "{query}" == "addToWatchList" ]]; then
	watchlist="${HOME}/Library/Application Support/Alfred 2/Workflow Data/com.vitorgalvao.alfred.watchlist/watchlist.txt"

	filename=$(python youtube-dl -f 22/18/17 -o "${HOME}/Downloads/%(title)s.%(ext)s" --get-filename "$(pbpaste)")
	python youtube-dl -f 22/18/17 -o "${HOME}/Downloads/%(title)s.%(ext)s" "$(pbpaste)"

	echo "${filename}" >> "${watchlist}"
	echo "Done."
else
	python youtube-dl -f 22/18/17 -o "${HOME}/Desktop/%(title)s.%(ext)s" "$(pbpaste)"
	echo "Done."
fi

The solution is the -f 22/18/17 option, which will download the best version available of either mp4 [720x1280], mp4 [360x640], or mp4 [144x176].

Edited by Vítor
Link to post
  • vitor changed the title to DownMedia — Download media from popular sources

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...