Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download precompiled version of yt-dlp on macOS #259

Closed
wants to merge 0 commits into from

Conversation

StefanLobbenmeier
Copy link
Contributor

@StefanLobbenmeier StefanLobbenmeier commented Dec 18, 2021

Aims to fix #243

When doing manual testing of this I noticed 2 things:

  • When running via npm run start I had to restart after the file has been downloaded, otherwise the download fails "EACCESS" or is stuck at downloading metadata. Quite strange / but maybe you experienced that before? It does not happen in the finished build though, or on any future runs.
  • When only running npx electron-builder --mac as the readme suggests the build .app did not contain youtube-dl-gui/dist/mac/Open Video Downloader.app/Contents/Resources/app.asar.unpacked. Possibly they are only included if the application has run before via npm run start and populated the binaries folder that way, but I do not know for sure, since it seems to work in the CI.

@StefanLobbenmeier
Copy link
Contributor Author

I confirmed this works without python3 on my machine (macOS BigSur 11.4) by starting the application like this:

➜  MacOS alias python3=""
➜  MacOS pwd
/Applications/Open Video Downloader 2.4.0 with youtube-dlp macos native.app/Contents/MacOS
➜  MacOS ./Open\ Video\ Downloader 

but I am not 100% sure if that actually verifies it. Would be nice also test this on another machine.

On another machine running Sierra I instead get this error:
"stderr": "[90366] Error loading Python lib '/var/folders/zm/g405m8rx6dz8lpt_18rsfydr0000gp/T/_MEILLpBuv/Python3': dlopen: dlopen(/var/folders/zm/g405m8rx6dz8lpt_18rsfydr0000gp/T/_MEILLpBuv/Python3, 10): Symbol not found: _futimens\n  Referenced from: /var/folders/zm/g405m8rx6dz8lpt_18rsfydr0000gp/T/_MEILLpBuv/Python3\n  Expected in: /usr/lib/libSystem.B.dylib\n in /var/folders/zm/g405m8rx6dz8lpt_18rsfydr0000gp/T/_MEILLpBuv/Python3",

I am assuming it fails on Sierra since it is so old and the pyinstaller dropped support for this, but I could not find any evidence for this.

@StefanLobbenmeier
Copy link
Contributor Author

StefanLobbenmeier commented Dec 18, 2021

@mark-up any chance you would be willing to test this on your machine as well? Since you already have a javascript project on your profile I assume you can build this on your machine? The one that Github uploaded here seems to be missing the the app.asar.unpacked, so it doesn't work on my machine: https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/tag/v2.4.0-youtube-dlp-macos-native

@jely2002
Copy link
Owner

Thanks a lot for looking into this. I don't possess a Mac anymore. Hence why this is broken, I wasn't able to test it properly.
The changes look good!

About you getting an EACCESS. This is probably because the downloaded file isn't marked as executable yet. I set it to executable with chmod on start of the app, so this would be another bug.

About the app.asar.unpacked missing, I have never had that happen before. So not sure what happened there.

@mark-up
Copy link

mark-up commented Dec 19, 2021

I assume you can build this on your machine?

@StefanLobbenmeier I'm sorry, I have no idea how. Would be happy to take a stab at it if you have instructions somewhere I can follow.

@StefanLobbenmeier
Copy link
Contributor Author

Oh I see - you can try building with the instructions here: https://github.com/StefanLobbenmeier/youtube-dl-gui/blob/patch-1/CONTRIBUTING.md

But I also went ahead and updated the tag https://github.com/StefanLobbenmeier/youtube-dl-gui/releases/tag/v2.4.0-youtube-dlp-macos-native with the version I built locally so that should also work

@mark-up
Copy link

mark-up commented Dec 20, 2021

Thanks, I tried the one you built and received this error:

{
"shortMessage": "Command failed with exit code 1: /Applications/Open Video Downloader.app/Contents/Resources/app.asar.unpacked/binaries/yt-dlp_macos -J --flat-playlist --no-cache-dir --ignore-config --user-agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15 --no-check-certificate --yes-playlist https://www.youtube.com/watch?v=REMOVED_BY_ME",
"command": "/Applications/Open Video Downloader.app/Contents/Resources/app.asar.unpacked/binaries/yt-dlp_macos -J --flat-playlist --no-cache-dir --ignore-config --user-agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15 --no-check-certificate --yes-playlist https://www.youtube.com/watch?v=REMOVED_BY_ME",
"exitCode": 1,
"stdout": "",
"stderr": "Traceback (most recent call last):\n File "yt_dlp/main.py", line 16, in \n File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module\n File "yt_dlp/init.py", line 16, in \n File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module\n File "yt_dlp/options.py", line 15, in \n File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module\n File "yt_dlp/utils.py", line 33, in \n File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module\n File "ssl.py", line 98, in \nImportError: dlopen(/var/folders/s8/b9l3m11x43v_0xp4gd2kgfg80000gn/T/_MEIq4d0Qn/lib-dynload/_ssl.cpython-38-darwin.so, 2): Library not loaded: /usr/lib/libssl.46.dylib\n Referenced from: /var/folders/s8/b9l3m11x43v_0xp4gd2kgfg80000gn/T/_MEIq4d0Qn/lib-dynload/_ssl.cpython-38-darwin.so\n Reason: image not found\n[3314] Failed to execute script 'main' due to unhandled exception!",
"failed": true,
"timedOut": false,
"isCanceled": false,
"killed": false
}

@StefanLobbenmeier
Copy link
Contributor Author

I see - thanks for testing. I guess that means we can put this pr on pause till this gets fixed in YouTube dlp :/

@mark-up
Copy link

mark-up commented Dec 21, 2021

Thanks for trying. I appreciate your effort.

Wish I could contribute, but this stuff is way beyond me.

@jely2002 jely2002 added the awaiting upstream This issue or PR is waiting on upstream changes label Jan 9, 2022
@StefanLobbenmeier
Copy link
Contributor Author

Found someone having the same issue as me on Sierra:
pyinstaller/pyinstaller#3418 (comment)

So in principle we can make this work by building yt-dlp on an older Mac.

I checked which version gitlab actions support, and unfortunately it only supports Catalina and up. Luckily someone else also has this exact issue: actions/runner-images#1256 (comment)

So I will try to get yt-dlp action to lower their deployment target - that should help

@StefanLobbenmeier
Copy link
Contributor Author

I implemented compiling with a lower macOS target, but I need some time to access a macOS machine with a lower version.

In the meantime, maybe @mark-up might be willing to do a test?

  1. Run yt-dlp_macos_legacy from https://github.com/StefanLobbenmeier/yt-dlp/releases/tag/2022.06.18.165703
  2. Replace yt-dlp in the openvideodownloader 2.4.0 with the mine, disable auto update, and attempt to download a video with it.

On Monterey it works:

➜  Downloads ./yt-dlp_macos_legacy https://www.youtube.com/watch\?v\=4KQwiUTQgCM
[youtube] 4KQwiUTQgCM: Downloading webpage
[youtube] 4KQwiUTQgCM: Downloading android player API JSON
[youtube] 4KQwiUTQgCM: Downloading player f05de49d
[info] 4KQwiUTQgCM: Downloading 1 format(s): 303+251
[download] Destination: Zack Merci - BOUNCE! (feat. Nieko) [NCS Release] [4KQwiUTQgCM].f303.webm
[download]  35.8% of 38.77MiB at    5.38MiB/s ETA 00:04^C
ERROR: Interrupted by user

I might be able to access the Sierra machine tomorrow evening or next weekend, we will see. I will also check how easy it is to get those older macOS versions in qemu so I can test on my own :)

@StefanLobbenmeier
Copy link
Contributor Author

Will open a separate PR - now yt-dlp supports older macOS versions via macos_legacy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting upstream This issue or PR is waiting on upstream changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error! Unhandled error (execa).
3 participants