Jump to content

Download Media — Download video and audio from web pages


Recommended Posts

  • 1 month later...

Thanks Vitor!!   This is the very first Alfred Workflow I have downloaded and used, and it works great!! 
I am very, very, very new to Alfred and all things having to do with running commands in terminal and workflows using Alfred, etc...

I feel like I have opened up a whole new world of fun stuff to learn and use with my computer (Mac) and have you to thank.

I remember in 4th grade when I first was taught basic Algebra (2 - x = 5) and I was blown away at this new way to solve a problem, and felt so excited about Math and this fun new way to think.  Unfortunately I went a different way in my life then was good for me - and only now at 45 years old do I have the motivation to learn something new.  After using these workflows and learning about commands in terminal, etc.. I feel just like that kid in 4th grade, with my mind open and am looking forward to this new journey.

 

Thank you so much!

iMan

Link to comment
On 11/6/2019 at 7:52 PM, benboozle said:

I can't for the life of me figure out how to change the audio format from .opus to something like .mp3? Can anyone walk a newbie through it? Thank you!

 

  1. Open the Workflow in Preferences.
  2. Click the [𝓍] icon on the top right.
  3. Change the value in audio_format, on the right.

Link to comment
On 8/19/2019 at 2:22 PM, vitor said:

That’s a good point. For everyone with an issue, do you have custom download_dir or watchlist_download_dir values (Workfow Environment Variables)? What are they? If you delete them, does the issue go away? Paths should be absolute or use ~ to represent the home directory (e.g. ~/Downloads). It may be worth to delete and redownload the Workflow but tell Alfred to not import the previous settings.

After this post, who still has an issue?

 

I think my problem is the same.

 

I have deleted and imported the workflow several times already choosing not to import previous settings. I have also checked that the paths are ~/Downloads. But I still cannot manage to get it to work.

 

I think I follow the instructions correctly. 

 

1. I open a youtube video. 

2. Copy the URL to my clipboard. (for example: https://youtu.be/tRcPA7Fzebw but I've tried many other links from YouTube and other websites supported by youtube-dl)

3. Type “dv” into Alfred.

4. Press enter / or click on the suggested search result (which is Downvid's “Download video / Downloads the video to ~/Downloads)

 

But I don't get a notification. I have also tried “dvp”  but it says that there are no downloads in process.

 

I haven't tried to install youtube-dl or anything else as it is my understanding the workflow takes care of everything it needs itself. 

 

 

The debug log:


 

[03:45:46.503] DownVid[Script Filter] Queuing argument ''

[03:45:46.877] DownVid[Script Filter] Script with argument '' finished

[03:45:46.881] DownVid[Script Filter] {"items":[{"uid":"dv","title":"Download Video","subtitle":"Downloads the video to ~/Downloads","arg":"/Users/elv/Downloads video watchlist_false playlist_false","mods":{"cmd":{"subtitle":"Download full playlist","arg":"/Users/elv/Downloads video watchlist_false playlist_true"}}},{"uid":"da","title":"Download Audio","subtitle":"Downloads the audio to ~/Downloads","arg":"/Users/elv/Downloads audio watchlist_false playlist_false","mods":{"cmd":{"subtitle":"Download full playlist","arg":"/Users/elv/Downloads audio watchlist_false playlist_true"}}}]}

[03:45:48.143] DownVid[Script Filter] Processing complete

[03:45:48.146] DownVid[Script Filter] Passing output '/Users/elv/Downloads video watchlist_false playlist_false' to Run Script

[03:45:48.453] ERROR: DownVid[Run Script] Could not download resource.

./downvid: line 8: sed: No such file or directory

./downvid: line 9: sed: No such file or directory

./downvid: line 13: awk: No such file or directory

./downvid: line 14: awk: No such file or directory

./downvid: line 15: awk: No such file or directory

./downvid: line 16: awk: No such file or directory

./downvid: line 46: youtube-dl: No such file or directory

./downvid: line 50: basename: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 8: basename: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 9: dirname: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 9: dirname: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 9: dirname: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 10: dirname: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 10: dirname: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 10: dirname: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 66: touch: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 67: osascript: No such file or directory

./Notificator.app/Contents/Resources/Scripts/notificator: line 68: /MacOS/applet: No such file or directory

[03:45:48.465] DownVid[Run Script] Processing complete

[03:45:48.467] DownVid[Run Script] Passing output '' to Run Script

 

I also ran the commands you suggested on Terminal:

 

ELV:~ elv$ which sed
/usr/bin/sed
ELV:~ elv$ which awk
/usr/bin/awk
ELV:~ elv$ which youtube-dl
ELV:~ elv$ 

 

 

I am running on a fresh install of Mojave (10.14.6). I don't think I've done anything to alter the system significantly

Alfred version is 4.0.1


Any idea what's wrong?

 

Nevermind.

 

My firewall was blocking internet access to cURL.

 

The workflow is working now.

Edited by Thomas Dunne
Link to comment
  • 3 weeks later...

I've been having problems with this workflow lately and haven't been able to figure it out, so I thought I'd share it back here. So far, I've had no issues getting the workflow to initiate downloads. It correctly downloads the video and audio files. After muxing, though, it throws the following error (for example, from the video located https://www.youtube.com/watch?v=W3NWOShvLug) when inspecting the progress using dvp:

 

[14:24:00.383] DownVid[Script Filter] {"rerun":1,"items":[{"title":"DownVid Progress","subtitle":"ffmpeg There re't y subtites t embe / Exploring The Path to Carcosa Expansion w_ Matt Newman.f137.mp4","valid":false,"mods":{"ctrl":{"valid":true},"cmd":{"valid":true}}}]}

Furthermore, it appears that the background bash process then hangs. The muxed file is located in my downloads folder and can be watched with no issues. If I delete the video file, DownVid finally throws the notification that it's completed downloading and the hung bash processes quit.

 

Because I've seen it requested elsewhere, from my Terminal:

┌─ Brad ~/Downloads 
┕> which sed
/usr/bin/sed

┌─ Brad ~/Downloads 
┕> which youtube-dl
/usr/local/bin/youtube-dl

┌─ Brad ~/Downloads 
┕> youtube-dl --version
2019.11.28

Any thoughts on how I can fix this? Here's the output when I run it through youtube-dl using my standard settings:

┌─ Brad ~/Downloads 
┕> youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' --all-subs --convert-subs srt --write-thumbnail https://www.youtube.com/watch\?v\=W3NWOShvLug     
[youtube] W3NWOShvLug: Downloading webpage
[youtube] W3NWOShvLug: Downloading video info webpage
WARNING: video doesn't have subtitles
[youtube] W3NWOShvLug: Downloading thumbnail ...
[youtube] W3NWOShvLug: Writing thumbnail to: Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.jpg
[download] Destination: Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.f137.mp4
[download] 100% of 205.21MiB in 00:13
[download] Destination: Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.f140.m4a
[download] 100% of 13.21MiB in 00:02
[ffmpeg] Merging formats into "Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.mp4"
Deleting original file Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.f137.mp4 (pass -k to keep)
Deleting original file Exploring The Path to Carcosa Expansion w_ Matt Newman-W3NWOShvLug.f140.m4a (pass -k to keep)
[ffmpeg] There aren't any subtitles to convert

 

Link to comment
On 11/30/2019 at 8:34 PM, buffaloseven said:

After muxing, though, it throws the following error

 

That’s not an error, it’s regular Alfred information on what the Script Filter is showing. You’ll see that in your example of running youtube-dl, similar information is given.


Unfortunately, I’ve not been able to reproduce your error.

Link to comment

Hmmm. Here's another example. It never notifies me that the file is complete (no downloaded notification is triggered) and just hangs like this forever unless I use the abort (Ctrl key shortcut) to cancel it or manually kill the bash process.

 

Worth noting, that for the example shown in the screenshot, the file was in fact muxed and available in my Downloads folder...so is something just hanging and preventing it from finishing out the process?

Screen Shot 2019-12-03 at 9.58.24 PM.jpg

Link to comment

I'm running: 

 

- macOS 10.15.1 (19B88)

- ffmpeg version 4.2.1

┌─ Brad ~/Downloads 
┕> ffmpeg -version
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.8)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100

- Alfred 4.0.6

- Downvid 1.22.12

 

Querying ffmpeg in your workflow's resource folder doesn't work, as I assume it doesn't fetch it if the system has it installed already?

Link to comment
16 minutes ago, buffaloseven said:

Querying ffmpeg in your workflow's resource folder doesn't work, as I assume it doesn't fetch it if the system has it installed already?

 

Correct.

 

I doubt this is the issue but let’s check anyway, one step at a time: open the Workflow’s directory in a Terminal and run ./Notificator.app/Contents/Resources/Scripts/notificator --message 'testing'. What’s the result?

Link to comment

Never doubt the simple solutions:

┌─ Brad Workflow Data/com.vitorgalvao.alfred._sharedresources/bin 
┕> ./Notificator.app/Contents/Resources/Scripts/notificator --message 'testing'
zsh: no such file or directory: ./Notificator.app/Contents/Resources/Scripts/notificator

Also, I noticed that there is a copy of youtube-dl, but it's not located in the bin folder, it's in the parent folder.

Link to comment

You’re in the Workflow Data directory for the shared resources. I mean the Workflow’s directory, as in right-click the Workflow in Alfred and pick Open in Terminal.

 

39 minutes ago, buffaloseven said:

Also, I noticed that there is a copy of youtube-dl, but it's not located in the bin folder, it's in the parent folder.

 

Likely a remnant of how the script that deals with it used to work. You can delete it.

Link to comment

I did a bunch of testing tonight and was able to figure out where the problem is occurring. After updating everything and setting everything up fresh, I was still having the problem. I manually commented out parts of the DV bash script until I found the problematic lines:

    # xattr seems to return before the action is complete, not giving enough time for the file to have the attribute before sending to WatchList, so only continue after the attribute is present
    until mdls -raw -name kMDItemWhereFroms "${filename}" | grep --quiet --invert-match '(null)'; do
        sleep 1
    done

If I comment out this line, all works as expected. Any ideas on how I could troubleshoot this further? I'm guessing that the until never resolves, so it's just sleeping until I manually kill it.

 

Relatedly, you can fix the problem with missing letters in the dvp Alfred script filter by changing

	progress = filecontents[-1].delete('[download]').strip
to
	progress = filecontents[-1].sub('[download]', '').strip

 

Edited by buffaloseven
Link to comment
8 hours ago, buffaloseven said:

I did a bunch of testing tonight and was able to figure out where the problem is occurring.

 

Nice debugging.

 

8 hours ago, buffaloseven said:

Any ideas on how I could troubleshoot this further?

 

Yes. You likely have a broken xattr.

  1. Run export PATH='/usr/bin:/bin:/usr/sbin:/sbin' (to mimic Alfred’s PATH).
  2. Run /usr/bin/xattr.
  3. If you got, ImportError: No module named pkg_resources, carry on with these steps. Other errors are harder to fix.
  4. Do /usr/bin/python --version.
  5. If you got a 2.7 version, your python installation has a broken version of setuptools. To fix, try sudo /usr/bin/python -m pip install -I setuptools. Done. Retry the Workflow.
  6. If you got a different version, the system python version is wrong. To fix, try 'defaults write com.apple.versioner.python Version 2.7'.  Done. Retry the Workflow.

 

8 hours ago, buffaloseven said:

Relatedly, you can fix the problem with missing letters in the dvp Alfred script filter by changing

 

Thank you. That was old code I never revisited.

Link to comment

Thanks for the quick reply. Everything is set up properly and xattr is present and functions from /usr/bin/xattr. I decided to enter into the the workflow directory and run it in the terminal instead of through Alfred, and got the following output:

 

┌─ Brad Alfred.alfredpreferences/workflows/user.workflow.4DC46062-706A-4E1E-975E-EECCD63ECD3E took 10s 
┕> ./downvid "https://www.youtube.com/watch?v=A6XFbNBT-h8" video watchlist_false playlist_false
ERROR: unable to open for writing: [Errno 30] Read-only file system: '/My Top 10 Favorite Games of 2019.m4a.part'
./downvid: /usr/local/bin/xattr: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

I'm not sure if that writing error is important (is it just something I'm missing by not triggering through Alfred?), but I noticed for some reason it's looking for /usr/local/bin instead of /usr/bin?

Link to comment

No, /usr/local/bin/xattr does not work and I can't seem to get pip to install it correctly to that location using a python located in /usr/local/bin/python. Replacing xattr with /usr/bin/xattr did indeed fix the problem, though!

 

Now to figure out why I have so many python installs...

python_environment.png

Edited by buffaloseven
Link to comment
  • 4 weeks later...
On 6/19/2017 at 11:11 PM, Karl Klammer said:

Using Alfred for years I only just found this workflow and I'm impressed how easy and great it works. But - and read the whole thread - all my youtube test downloads were downloaded in 720p and I have no idea why. Example: Big Buck Bunny in 4k

 

I found this comment but have no idea where I how I might need to modify something.

 

Thanks in advance and best regards!

 

Dear Vitor,

 

Thanks for a killer workflow. It has been a great companion in my online life.

 

I am facing this issue as well, but ONLY when trying to download a video that is private (ie. everybody with the URL can see it).

 

Here is my log:

[06:15:14.374] DownVid[Script Filter] Queuing argument ''
[06:15:14.560] DownVid[Script Filter] Script with argv '' finished
[06:15:14.564] DownVid[Script Filter] {"items":[{"uid":"dv","title":"Download Video","subtitle":"Downloads the video to ~/Desktop","arg":"https://www.youtube.com/watch?v=Cyiro3AnCkg& video watchlist_false playlist_false","mods":{"cmd":{"subtitle":"Download full playlist","arg":"https://www.youtube.com/watch?v=Cyiro3AnCkg& video watchlist_false playlist_true"}}},{"uid":"da","title":"Download Audio","subtitle":"Downloads the audio to ~/Desktop","arg":"https://www.youtube.com/watch?v=Cyiro3AnCkg& audio watchlist_false playlist_false","mods":{"cmd":{"subtitle":"Download full playlist","arg":"https://www.youtube.com/watch?v=Cyiro3AnCkg& audio watchlist_false playlist_true"}}}]}
[06:15:15.006] DownVid[Script Filter] Processing complete
[06:15:15.009] DownVid[Script Filter] Passing output 'https://www.youtube.com/watch?v=Cyiro3AnCkg& video watchlist_false playlist_false' to Run Script
[06:15:33.871] STDERR: DownVid[Run Script] WARNING: video doesn't have subtitles
[06:15:33.877] DownVid[Run Script] Processing complete
[06:15:33.877] DownVid[Run Script] Passing output '' to Run Script

Is this a known issue? I searched the issues of youtube-dl on Github, but I have not found a similar issue.

 

Thank you for your time.

N

Link to comment
13 hours ago, Northern said:

Thanks for a killer workflow.

 

Thank you for the kind words, and welcome to the forums.

 

13 hours ago, Northern said:

but ONLY when trying to download a video that is private (ie. everybody with the URL can see it)

 

That’s an unlisted video, not a private one.

 

13 hours ago, Northern said:

Is this a known issue?

 

Yes, as you can see from the posts after the one you quoted. It might be a bug or might be a configuration you have on your machine. Either way, it’s a youtube-dl matter, not related to the Workflow.

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