tomasklaen / uosc

Feature-rich minimalist proximity-based UI for MPV player.
GNU Lesser General Public License v2.1
1.8k stars 68 forks source link

Adding Podnapisi.net as an alternative subtitle provider #761

Open tomasklaen opened 1 year ago

tomasklaen commented 1 year ago

Originally posted by @kasper93 in https://github.com/tomasklaen/uosc/issues/490#issuecomment-1790528773

They provide XML API. Maybe it is not advertised well, but it is documented on forum here https://www.podnapisi.net/forum/viewtopic.php?f=62&t=26164#p212652.

Client that we added in MPC-HC 8 years ago is still working fine today. There is no captcha, login requirement, etc. Not sure if it uses latest api version, but it still works. They also support the same hash as opensubtitles. https://github.com/mpc-hc/mpc-hc/blob/e37826845859bfbc360989aaef3807ef15a83768/src/mpc-hc/SubtitlesProvider.cpp#L548-L764

Apparently there is also JSON API https://github.com/Diaoul/subliminal/issues/916#issue-319478609 (MasterMind2k is podnapisi admin)

If you would be interested in adding it, I guess you can ping MasterMind2k with any questions. I don't want to summon him here prematurely :)

tomasklaen commented 1 year ago

If they have no limits and an API, I'd definitely like to add them as an alternative provider. But yeah, the API is undocumented. The XML thing from the forum post (for which I had to register an account 😢) is weird and old (even the endpoint has "old" in it, and that was 8 years ago). So I've tried to work out the json one from the subliminal issue:

https://hopp.sh/r/8GRtz2HsCk9q

The result is:

That's as much as I have time to reverse engineer it now.

kasper93 commented 1 year ago

is weird and old (even the endpoint has "old" in it, and that was 8 years ago).

Yeah, it got amended I think. Just use https://www.podnapisi.net/ppodnapisi/search

https://www.podnapisi.net/ppodnapisi/search?sK={keyword}&sJ={language},{language2}&sY={year}&sTS={season}&sTE={episode}&sMH={movie_hash}&sR={release}&sXML=1

As for download, you may use the http://www.podnaisi.net/subtitles/{ID}/download

https://hopp.sh/r/kM3cMh5W4K66 (if you remove sXML it responses with json, but year seems to not work then for whatever reason). But probably "new" API is also good candidate, I guess whichever works better. I agree it is not well defined, but seems to work and give some results. And like said before it is stable, because even old code still works.

No idea how to send the hash. And is it even the same hash open subtitles are using? Hashed 64kb from each end + file size?

Yes, the movie hash is/was the same as open subtitles is using, but not sure if it is supported in fact these days. Looking at web ui, there is no place to specify file/hash. So maybe it is not used these days.

EDIT:

Really slow, and sometimes I get 504 gateway timeout errors.

Agreed, but it depends, sometimes it is fast, sometimes it takes more time. Probably it is hosted on potato :)

EDIT2:

Maybe this also will give some insight https://github.com/Podnapisi-NET/service.subtitles.podnapisi xbmc plugin (but it is even different)