1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-26 01:27:07 +00:00

Use new endpoint for gestdown (#1949)

This endpoint rely on caching from cloudflare and will better scale.

Right now, I'm getting around 3M request per day, so I'd like to use the caching as much as possible.
This commit is contained in:
Antoine Aflalo 2022-09-26 18:09:41 -04:00 committed by GitHub
parent 56fb27aab4
commit 5413f31b41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,13 +84,10 @@ class GestdownProvider(Provider):
self._session.close() self._session.close()
def _subtitles_search(self, video, language: Language): def _subtitles_search(self, video, language: Language):
json_data = {
"search": f"{video.series} S{video.season:02}E{video.episode:02}",
"language": self._converter.convert(language.alpha3),
}
logger.debug("Post data: %s", json_data) logger.debug("Post data: %s", json_data)
response = self._session.post(f"{_BASE_URL}/subtitles/search", json=json_data) lang = self._converter.convert(language.alpha3)
response = self._session.get(f"{_BASE_URL}/subtitles/find/{lang}/{video.series}/{video.season}/{video.episode}")
# TODO: implement rate limiting # TODO: implement rate limiting
response.raise_for_status() response.raise_for_status()