vitor Posted April 16, 2013 Share Posted April 16, 2013 (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. ↩: Download.⌘↩: Download full playlist.⌥↩: Toggle adding to Watch List.Alternatively, download with the Universal Action. Check download progress via the dp keyword. ⌘↩: Restart download.⌃↩: Cancel.⤓ Install on the Alfred Gallery | Source Edited March 21 by vitor deanishe, bikeNik, paulw and 8 others 11 Link to comment
JustLovely Posted April 17, 2013 Share Posted April 17, 2013 (edited) Just tested this and this works fantastically! Thanks for this great workflow! =) Edited April 17, 2013 by JustLovely Link to comment
Ddyracer Posted April 17, 2013 Share Posted April 17, 2013 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. 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. 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 comment
vitor Posted April 17, 2013 Author Share Posted April 17, 2013 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 comment
Ddyracer Posted April 17, 2013 Share Posted April 17, 2013 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. Link to comment
vitor Posted April 17, 2013 Author Share Posted April 17, 2013 (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 April 28, 2015 by Vítor JacobMiller 1 Link to comment
vitor Posted April 18, 2013 Author Share Posted April 18, 2013 (edited) Update. The upload JSON was pointing to the wrong files, so you’ll need to download it again to receive further updates. Edited April 18, 2013 by Vítor Link to comment
Ddyracer Posted April 18, 2013 Share Posted April 18, 2013 I think I will just convert the video with osx built in encoder. Definitely faster. Link to comment
vitor Posted April 18, 2013 Author Share Posted April 18, 2013 (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 April 18, 2013 by Vítor JacobMiller 1 Link to comment
Ddyracer Posted April 18, 2013 Share Posted April 18, 2013 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 comment
vitor Posted April 18, 2013 Author Share Posted April 18, 2013 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 comment
Ddyracer Posted April 18, 2013 Share Posted April 18, 2013 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 comment
vitor Posted April 23, 2013 Author Share Posted April 23, 2013 (edited) Update.If you have WatchList, you can now add a file directly to it after download (check the original post for details). Edited April 23, 2013 by Vítor Link to comment
npeeps Posted April 24, 2013 Share Posted April 24, 2013 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 comment
vitor Posted April 25, 2013 Author Share Posted April 25, 2013 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 comment
npeeps Posted April 25, 2013 Share Posted April 25, 2013 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 comment
vitor Posted April 25, 2013 Author Share Posted April 25, 2013 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 comment
npeeps Posted April 25, 2013 Share Posted April 25, 2013 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 comment
vitor Posted April 25, 2013 Author Share Posted April 25, 2013 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 comment
npeeps Posted April 26, 2013 Share Posted April 26, 2013 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 comment
vitor Posted April 26, 2013 Author Share Posted April 26, 2013 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 comment
DJay Posted April 26, 2013 Share Posted April 26, 2013 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. Link to comment
raguay.customct Posted April 26, 2013 Share Posted April 26, 2013 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. Hi, just download this http://www.any-video-converter.com/products/for_video_free/ and it will convert the flv to any format you want. Link to comment
vitor Posted April 26, 2013 Author Share Posted April 26, 2013 (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 April 26, 2013 by Vítor DJay and dan_djorgi 2 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now