Jump to content

Download Media — Download video and audio from web pages


Recommended Posts

Posted (edited)

Usage


Download video from a plethora of online sources via the dv keyword. Download audio with da. Your clipboard and frontmost browser tab are checked for links.


dv.png

  • ↩: Download.
  • ⌘↩: Download full playlist.
  • ⌥↩: Toggle adding to Watch List.

Alternatively, download with the Universal Action.


ua.png


Check download progress via the dp keyword.


dp.png

  • ⌘↩: Restart download.
  • ⌃↩: Cancel.

⤓ Install on the Alfred Gallery | Source

 

Edited by vitor
Posted

Frequently Asked Questions (FAQ)


Why is the download failing?


It is likely that your installation of yt-dlp is outdated. Update the dependencies and try again.


If the download still fails, open a terminal and run the following (replace YOUR/URL/HERE within the quotes with the failing URL):


PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
yt-dlp "YOUR/URL/HERE"


Then report the error on the yt-dlp issue tracker, as they’re the ones who’ll be able to fix the issue. The workflow relies on that tool for the downloads.


How do I report a different issue?


Accurate and thorough information is crucial for a proper diagnosis. When reporting issues, please include your exact installed versions of:

  • The Workflow.
  • Alfred.
  • macOS.

In addition to:

  • The debugger output. Perform the failing action and click Copy on the top right.
  • Details on what you did, what happened, and what you expected to happen. A short video of the steps with the debugger open may help to find the problem faster.

Posted

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.

I need help.
Posted (edited)

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
Posted (edited)

Update.

The upload JSON was pointing to the wrong files, so you’ll need to download it again to receive further updates.

Edited by Vítor
Posted (edited)

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
Posted

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.

Posted

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.

Posted

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

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!

Posted

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.

Posted

 

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

Posted

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.

Posted

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!

Posted

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.

Posted

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!
Posted

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.

Posted

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.

Posted (edited)

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

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