TeamNewPipe / NewPipeExtractor

NewPipe's core library for extracting data from streaming sites
GNU General Public License v3.0
1.34k stars 405 forks source link

Missing Downloader implementations #1159

Open aratare-jp opened 6 months ago

aratare-jp commented 6 months ago

Hello there.

First of all, thanks a lot for this tool. I've been looking into using this for some of my personal projects and it has proven to be really great, despite the lack of tutorials/docs which makes things harder to understand for new people like me.

Anyway, onward to the actual question: I notice that, by default, there is no implementation class for Downloader, and it threw me off quite a bit when I wanted to parse a Youtube video URL with a YoutubeStreamExtractor.

I managed to find this in NewPipe and had to C&P it over and remove all of the Android-related code. So all is well now, but is there a reason for this?

AudricV commented 6 months ago

I've been looking into using this for some of my personal projects and it has proven to be really great, despite the lack of tutorials/docs which makes things harder to understand for new people like me.

If you have some ideas or suggestions, or even if you want to contribute on that, free feel to open issues :)

is there a reason for this?

Yes, the goal of the Downloader interface is to not depend on a specific network stack.

I managed to find this in NewPipe and had to C&P it over and remove all of the Android-related code.

You could have looked at the extractor test implementation instead (note that the 429 HTTP response code handling is a very bad way to handle captcha responses at the moment, in the app and in the extractor).

Anyway, is the documentation of the Downloader class not enough to let you easily create an implementation?

aratare-jp commented 6 months ago

If you have some ideas or suggestions, or even if you want to contribute on that, free feel to open issues :)

Yes I'm thinking about adding a new How-to section into the doc. This can be dedicated for different how-tos like fetching channels, video stream URLs, etc. Do let me know if you think this is helpful or not.

Yes, the goal of the Downloader interface is to not depend on a specific network stack.

I understand that. My question was more about why there wasn't any "default" implementation of this so that people can use it out of the box. It actually took me a while to know that there wasn't one provided.

is the documentation of the Downloader class not enough to let you easily create an implementation?

Create an implementation: yes. Create an implementation that works properly: not so easily. For example, from the DownloaderImpl class within NewPipe, the execute function needs to set specific headers, handle ReCaptcha, set cookies, etc. in order to, my guess is, fetch stuff properly from Youtube. These little things are hard to know when one's required to create an implementation from scratch when they just want to make use of the library to fetch a streamable URL, for example. At least for me, it was not easily enough that I ended up choosing to C&P the class from NewPipe over, rather than creating one from scratch.

I think just a standard YouTubeDownloader or something would be something very beneficial to have in the library.