libre-tube / LibreTube

An alternative frontend for YouTube, for Android.
https://libretube.dev
GNU General Public License v3.0
8.47k stars 443 forks source link

Add local Piped instance #6363

Closed Eco-Gaming closed 2 weeks ago

Eco-Gaming commented 3 weeks ago

Describe your suggested feature

It would be very nice if LibreTube offered the same functionality as NewPipe, where the app itself has its own piped instance.

Other details

As all the public Piped instances are majorly struggling against YouTube right now, I effectively can't use LibreTube anymore (unless I'm using a small private instance). NewPipe however still works just fine, but I significantly prefer the UI/UX of LibreTube.

This is somewhat similar to #4686, but the suggested fix there does not work if the selected piped instance is completely being blocked by YouTube.

Acknowledgements

PhrozenByte commented 3 weeks ago

I'd like to poke a little deeper into this. What is the reason why LibreTube currently can't start a video even tough the Piped proxy is disabled?

LibreTube depends on a Piped instance to fetch a video's metadata (including the info that a video even exists). For streaming it can indeed either use the Piped proxy, or directly stream from YouTube's servers. However, the issues Piped faces right now isn't really interfering with metadata fetching, isn't it? Piped and consequently also LibreTube still shows new videos, it's just that neither can play the video. However, LibreTube already comes with the option to disable the Piped proxy. So, what's LibreTube currently stopping from using the metadata provided by Piped to directly stream the video from YouTube's servers and therefore circumventing YouTube's blockage of the Piped instance?

Ehab-d commented 3 weeks ago

Running Piped locally on Android phone could reveal IP addresses, but it would make the experience more stable. This is probably better than the app not working at all right now, not on any Instance! So we NewPipe for a while.

Eco-Gaming commented 3 weeks ago

I'd like to poke a little deeper into this. What is the reason why LibreTube currently can't start a video even tough the Piped proxy is disabled?

LibreTube depends on a Piped instance to fetch a video's metadata (including the info that a video even exists). For streaming it can indeed either use the Piped proxy, or directly stream from YouTube's servers. However, the issues Piped faces right now isn't really interfering with metadata fetching, isn't it? Piped and consequently also LibreTube still shows new videos, it's just that neither can play the video. However, LibreTube already comes with the option to disable the Piped proxy. So, what's LibreTube currently stopping from using the metadata provided by Piped to directly stream the video from YouTube's servers and therefore circumventing YouTube's blockage of the Piped instance?

I did some experiments, the issue with that is that if a piped server gets queried for metadata, it will only return it when the video can be fully played.

For example, https://pipedapi.drgns.space/streams/dQw4w9WgXcQ only returns 'Got error: "Sign in to confirm that you're not a bot"'. The /streams endpoint is queried in LibreTube whenever the PlayerFragment starts playing a video (in PlayerFragment.playVideo()). The /streams endpoint seems to pretty much be required as it provides (among others) title, comments, description, but also things like duration, subtitles, chapters, …

Maybe a super barebones player with just the video ID would still be possible as some kind of "Emergency Playback", but the main issue with your request seems to be Piped not providing the metadata over its API.

PhrozenByte commented 3 weeks ago

I did some experiments, the issue with that is that if a piped server gets queried for metadata, it will only return it when the video can be fully played.

That's very unfortunate. Thanks for diving deeper into the topic and sharing your findings! :heart: Looks like that the Piped instance I use managed to temporarily get unblocked by YouTube to fetch new videos, but was blocked again later. Too bad. Let's hope that the Piped devs find a viable and permanent solution soon.

Bnyro commented 2 weeks ago

With https://github.com/libre-tube/LibreTube/pull/6381 it's possible to extract video information directly and LibreTube should work as expected again (without proxying the video playback).

As already explained in other issues, there are no plans to completely ditch Piped, since it does useful things such as syncing subscriptions across devices, ReturnYouTubeDislike, SponsorBlock integration, ... Apart from that LibreTube was initially built as Android client for Piped, and still is, as well as I am one of the two Piped maintainers.

pokegamer5547 commented 2 weeks ago

With #6381 it's possible to extract video information directly and LibreTube should work as expected again (without proxying the video playback).

As already explained in other issues, there are no plans to completely ditch Piped, since it does useful things such as syncing subscriptions across devices, ReturnYouTubeDislike, SponsorBlock integration, ... Apart from that LibreTube was initially built as Android client for Piped, and still is, as well as I am one of the two Piped maintainers.

Video playback is working now with this option but I'm unable to get descriptions, is it intentional?

Bnyro commented 2 weeks ago

Video playback is working now with this option but I'm unable to get descriptions, is it intentional?

No, I haven't tested this well enough yet apparently, I just tried to create a new release as fast as possible to make video playback functional again.

Bnyro commented 2 weeks ago

Please create a new issue about that.