flashdagger / ytdlp-plugins

plugin manager for yt-dlp which enables releases of extractors as separate python package
The Unlicense
44 stars 4 forks source link

How does it work? #5

Closed d33tah closed 1 year ago

d33tah commented 1 year ago

Thanks for creating this project! I'm curious how it works - specifically, what makes it affect the list of extractors that yt-dlp can see. Could you point me to the piece of code (or setup configuration) that extends an already installed yt-dlp binary, adding new code? I could use this monkey-patching capability in other projects too.

flashdagger commented 1 year ago

The yt-dlp binary is not changed. As Python is a highly dynamic language, we make use of imported python objects and alter them at runtime. You can take a look at ytdlp_plugins/patching.py for the methods we use.

d33tah commented 1 year ago

@flashdagger Thanks! I guess my question is: if I run yt-dlp, what makes this library get pulled in at runtime?

flashdagger commented 1 year ago

If you run yt-dlp no third party code will get pulled in. That's why this project has it's own executable ytdlp-plugins. That's where the plugins are injected.

d33tah commented 1 year ago

Thanks, that answers the question for me. Closing the issue :) Have a great day!

flashdagger commented 1 year ago

Nie ma za co 😄