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

Handle different binary filename at runtime #43

Closed
Hazmi35 opened this issue Sep 27, 2021 · 4 comments
Closed

Handle different binary filename at runtime #43

Hazmi35 opened this issue Sep 27, 2021 · 4 comments

Comments

@Hazmi35
Copy link
Contributor

Hazmi35 commented Sep 27, 2021

Why

I want to use yt-dlp with youtube-dl-exec. While using https://github.com/microlinkhq/youtube-dl-exec#environment-variables can download the correct binary, but on runtime, we need to set YOUTUBE_DL_FILENAME manually in process.env

How

It should implement or document how to handle different binary filenames at runtime.

Either document how to do it with process.env or create something to handle these different binary filenames, either way, I'm fine

@Kikobeats
Copy link
Member

Oh, gotcha.

What if we expose a constructor way, being the default module.exports bind to YOUTUBE_DL_PATH constant?

So users can continue using the library as usual and power users like you can take advantage of the constructor for creating different way to consume the binary.

@Hazmi35
Copy link
Contributor Author

Hazmi35 commented Sep 27, 2021

I agree with that

@61soldiers
Copy link

61soldiers commented Oct 9, 2021

My issue may somewhat be unrelated but can i change the path to the binary that yt-dl ultimately uses to download ?.
I have tried setting YOUTUBE_DL_DIR env variable to the desired path but youtube-dl-exec still tries to read the default path

The default path to the binary is inside app.asar and so it cannot read the binary. What i need it to point to is /app.asar.unpacked

Environment

  • Production build of electron using electron-builder

This would be the equivalent of https://github.com/przemyslawpluta/node-youtube-dl#changing-the-binary-path

Update

  • I have edited the code to accommodate the above mentioned feature, i also believe this could help op. Should i create a PR for this. I'm overriding the default path to binary by passing customBinaryPath (the one i made) into options in raw method.

@Kikobeats
Copy link
Member

youtube-dl-exec@1.3.0 added binary customization:

const { create: createYoutubeDl } = require('youtube-dl-exec')

const youtubedl = createYoutubeDl('/my/binary/path')

Also, added YOUTUBE_DL_SKIP_DOWNLOAD to avoid fetch youtube-dl remotely

YOUTUBE_DL_SKIP_DOWNLOAD=true npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants