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 80 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 Sqaaakoi June 1, 2024 00:54
@cheesesamwich
Copy link
Sponsor Contributor

this is pretty cool, maybe you could add other sites like spotify, twitter, reddit etc for ease of access

@cheesesamwich
Copy link
Sponsor Contributor

cheesesamwich commented Jun 5, 2024

this is pretty cool, maybe you could add other sites like spotify, twitter, reddit etc for ease of access

nevermind, i just checkedout the yt-dlp support info and they already support a ton of shit, i assumed because of the name it was only youtube lmao- good plugin!

@TheColorman
Copy link
Author

TheColorman commented Jun 5, 2024

@cheesesamwich

this is pretty cool, maybe you could add other sites like spotify, twitter, reddit etc for ease of access

Since it uses yt-dlp under the hood, it does support all of those sites. See this for the like 1500+ supported websites.

(I should probably add a link to that list somewhere in the plugin too)

@cheesesamwich
Copy link
Sponsor Contributor

Since it uses yt-dlp under the hood, it does support all of those sites.

Yeah i noticed that as soon as you replied, you should definitely mention the url or maybe even have an expandable/searchable list of the supported sites in the plugin about

@TheColorman
Copy link
Author

I've been thinking about renaming the plugin to something like "Video Downloader" to disconnect it a bit from the word "yt-dlp", as it's both more technical and only implies YouTube downloads. Thoughts?

@Scyye
Copy link

Scyye commented Jun 6, 2024

I've been thinking about renaming the plugin to something like "Video Downloader" to disconnect it a bit from the word "yt-dlp", as it's both more technical and only implies YouTube downloads. Thoughts?

"Media Embedder"?
"Media Sender"?
not sure, id not say "Video", as it supports more than video.

@cheesesamwich
Copy link
Sponsor Contributor

cheesesamwich commented Jun 8, 2024

I've been thinking about renaming the plugin to something like "Video Downloader" to disconnect it a bit from the word "yt-dlp", as it's both more technical and only implies YouTube downloads. Thoughts?

I'd recomend MediaDownloadCommand, or something similar. It's a really mistakable plugin so you want a good name

@TheColorman
Copy link
Author

TheColorman commented Jun 8, 2024

Decided on MediaDownloader for the name, feel like it captures what it does pretty well. I know it doesn't mention the sending part, but I feel like it's implied (but i'll take other suggesions).

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

8 participants