killergerbah / asbplayer

Browser-based media player and Chrome extension for subtitle sentence mining
MIT License
430 stars 48 forks source link

Support YouTube frontends (Invidious, Piped) #421

Open Kellenok opened 2 months ago

Kellenok commented 2 months ago

I wouldn't say it's critical for me, but there are definitely some users who are concerned about their privacy, so they don't use YouTube at all. Instead, they use third-party frontends like invidious and piped. The main problem is that there are many instances of such frontends, anyone can create them. so you will have to give the possibility to add your own links or somehow detect that the current site is an instance of the frontend.

Invidious

Docs — https://docs.invidious.io/ Instances — https://api.invidious.io/

I don't think it would be hard to do that for invidiuos, cause it gives you the option to download subtitles for the video, but as usual for auto subtitles there are duplicate lines there. image

Piped

Docs — https://docs.piped.video/docs/ Instances — https://github.com/TeamPiped/Piped/wiki/Instances

Piped doesn't give a direct way to download subtitles, but no one prevents you from extracting them from the same invidious. Issue about downloading

Kellenok commented 1 month ago

I've been doing a little more research on the subject, especially invidious, and I found out a few things.

  1. Subtitles are easily downloaded via api. First we get the subtitle title via https://{instance-link}/api/v1/captions/{video-id} and then the subtitles themselves in vtt format https://{instance-link}/api/v1/captions/{video-id}?label={label}
  2. Subtitles are already fixed and do not have repeated lines.
  3. Not all instances have subtitles and as a user there is nothing we can do about it. https://github.com/iv-org/invidious/issues/4660. So you have to make several attempts to get subtitles from different instances.