Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: subdivx version resolution for buscar param #2701

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions custom_libs/subliminal_patch/providers/subdivx.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
)
_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__)

Expand Down Expand Up @@ -161,6 +162,16 @@ def _query(self, video, languages):

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"

Expand All @@ -180,8 +191,8 @@ def _query_results(self, query, video):
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)

Expand Down