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

feat(plugin): yt-dlp integration #2480

Open
wants to merge 69 commits into
base: main
Choose a base branch
from

Conversation

TheColorman
Copy link

@TheColorman TheColorman commented May 18, 2024

This is a plugin that adds a yt-dlp command. You pass a url, it downloads it and readies it as an attachment. See the gif for a quick example.
based

It supports any URL supported by https://github.com/yt-dlp/yt-dlp.

Warning:

This plugin has 2 dependencies: yt-dlp and ffmpeg. yt-dlp gets automatically downloaded and stored locally, but ffmpeg does not, and thus needs to be installed by the user.

I have not yet tested this on Linux, and I might also add support for converting directly to gifs, but feel free to experiment and find bugs.

@TheColorman TheColorman marked this pull request as draft May 18, 2024 23:48
@rozbrajaczpoziomow
Copy link
Sponsor Contributor

rozbrajaczpoziomow commented May 18, 2024

Doesn't work under Linux (probably missing execute perm)
image

Also, why redownload yt-dlp if it is already installed on the system? (like on mine)

@Vendicated
Copy link
Owner

i love this plugin idea!

however based on a quick skim of the code, the current implementation is very questionable. why is ytdlp stored in indexeddb? you need it on the native side, not in the browser

i honestly don't think the plugin should download it for you. why not simply test if it's available and if not show the user a popup with instructions how to install it?

installing programs from a plugin is not something I want to do and it might trip anti malware engines, not to mention that it also just seems a little sussy. and on Linux this should really be handled via package manager anyway

we could just have the user install python themselves and then use pip to install it if it's missing

@TheColorman
Copy link
Author

TheColorman commented May 19, 2024

@rozbrajaczpoziomow

Doesn't work under Linux (probably missing execute perm)

Nice catch, weird that it's interrupting though, I thought I had error handling everywhere. I'll have to take a look at that.

Also, why redownload yt-dlp if it is already installed on the system? (like on mine)

Good point, should probably add a check.

@Vendicated

however based on a quick skim of the code, the current implementation is very questionable. why is ytdlp stored in
indexeddb? you need it on the native side, not in the browser

I wanted to store it somewhere and wasn't sure where else to do it..

i honestly don't think the plugin should download it for you. why not simply test if it's available and if not show the user a popup with instructions how to install it?

Yeah that's fair enough. I wanted to make it completely seamless, but halfway through I realised that doing the same to download ffmpeg would be a pain in the ass, so now it's in a bit of a weird state where half of the dependencies auto-install. This definitely makes more sense.

we could just have the user install python themselves and then use pip to install it if it's missing

I'm not sure that would add it to PATH, would it? I've always had to manually add yt-dlp to the PATH unless I entered a Python venv.

@Vendicated
Copy link
Owner

anything installed via pip should be in path. when you install python on windows there's an option to add python stuff to the PATH, you need to make sure to have it checked

in any case, you could just do python3 -m yt-dlp or even write a small python script that imports the module and uses the api from python

src/plugins/YtDlp/constants.ts Outdated Show resolved Hide resolved
src/plugins/YtDlp/index.ts Outdated Show resolved Hide resolved
@Sqaaakoi
Copy link
Contributor

Doesn't work under Linux (probably missing execute perm) image

Also, why redownload yt-dlp if it is already installed on the system? (like on mine)

it's running the windows version??

@TheColorman TheColorman requested a review from Scyye May 26, 2024 15:40
src/plugins/YtDlp/index.tsx Outdated Show resolved Hide resolved
src/plugins/YtDlp/index.tsx Outdated Show resolved Hide resolved
src/plugins/YtDlp/native.ts Outdated Show resolved Hide resolved
@Scyye
Copy link

Scyye commented May 26, 2024

Also, does this work on the web version?; if not, id mark it as such.

@rozbrajaczpoziomow
Copy link
Sponsor Contributor

lemme make you think about it for 1 second - if it has to download yt-dlp/ffmpeg locally, run child_process...

@Scyye
Copy link

Scyye commented May 26, 2024

lemme make you think about it for 1 second - if it has to download yt-dlp/ffmpeg locally, run child_process...

that was my point lol

@TheColorman
Copy link
Author

@Scyye

Also, does this work on the web version?; if not, id mark it as such.

How do I mark it as desktop only? I think I've seen a plugin or two using the .desktip.(ts/tsx) extension, is that sufficient?

@Scyye
Copy link

Scyye commented May 26, 2024

@Scyye

Also, does this work on the web version?; if not, id mark it as such.

How do I mark it as desktop only? I think I've seen a plugin or two using the .desktip.(ts/tsx) extension, is that sufficient?

rename the folder to pluginname.desktop im pretty sure

@TheColorman
Copy link
Author

With 8bc793c it should only build for desktop.

src/plugins/YtDlp/native.ts Outdated Show resolved Hide resolved
src/plugins/YtDlp/index.tsx Outdated Show resolved Hide resolved
@TheColorman TheColorman requested a review from Sqaaakoi June 1, 2024 00:54
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

Successfully merging this pull request may close these issues.

None yet

6 participants