diff options
author | Alvaro Chavez <[email protected]> | 2024-10-07 16:16:36 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-07 16:16:36 -0400 |
commit | 4f2bcc17d9de6e2d53cd43a5c24cc91f2ba90ff1 (patch) | |
tree | 1c165225a9bdcb3eaa4f4e9d60312595d77681c6 | |
parent | 7000d2ac2c7a52fd0c429c17f5e826e9e3633bfc (diff) | |
download | bazarr-4f2bcc17d9de6e2d53cd43a5c24cc91f2ba90ff1.tar.gz bazarr-4f2bcc17d9de6e2d53cd43a5c24cc91f2ba90ff1.zip |
Implemented subdivx version resolution for buscar parameterv1.4.6-beta.0
-rw-r--r-- | custom_libs/subliminal_patch/providers/subdivx.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/custom_libs/subliminal_patch/providers/subdivx.py b/custom_libs/subliminal_patch/providers/subdivx.py index 6a69dd37a..c9265f305 100644 --- a/custom_libs/subliminal_patch/providers/subdivx.py +++ b/custom_libs/subliminal_patch/providers/subdivx.py @@ -39,6 +39,7 @@ _SEASON_NUM_RE = re.compile( ) _EPISODE_YEAR_RE = re.compile(r"\((?P<x>(19\d{2}|20[0-2]\d))\)") _UNSUPPORTED_RE = re.compile(r"(extras|forzado(s)?|forced)\s?$", flags=re.IGNORECASE) +_VERSION_RESOLUTION = re.compile(r'id="vs">([^<]+)<\/div>') logger = logging.getLogger(__name__) @@ -161,6 +162,16 @@ class SubdivxSubtitlesProvider(Provider): return subtitles + def _get_vs(self): + # t["buscar" + $("#vs").html().replace(".", "").replace("v", "")] = $("#buscar").val(), + res = self.session.get('https://subdivx.com/') + results = _VERSION_RESOLUTION.findall(res.text) + if results is not None and len(results) == 0: + return -1 + version = results[0] + version = version.replace('.','').replace('v','') + return version + def _query_results(self, query, video): token_link = f"{_SERVER_URL}/inc/gt.php?gt=1" @@ -180,8 +191,8 @@ class SubdivxSubtitlesProvider(Provider): raise ProviderError("Response doesn't include a token") search_link = f"{_SERVER_URL}/inc/ajax.php" - - payload = {"tabla": "resultados", "filtros": "", "buscar393": query, "token": token} + version = self._get_vs() + payload = {"tabla": "resultados", "filtros": "", f"buscar{version}": query, "token": token} logger.debug("Query: %s", query) |