Skip to content

Commit

Permalink
Implemented subdivx version resolution for buscar parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarochvz authored Oct 7, 2024
1 parent 7000d2a commit 4f2bcc1
Showing 1 changed file with 13 additions and 2 deletions.
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

0 comments on commit 4f2bcc1

Please sign in to comment.