1
1
mirror of https://github.com/neosubhamoy/neodlp.git synced 2026-03-22 11:25:49 +05:30

chore: bumped up to v0.4.2

This commit is contained in:
2026-03-03 13:21:54 +05:30
Verified
parent d66334ab85
commit d5a6eba383
9 changed files with 484 additions and 408 deletions

View File

@@ -1,6 +1,6 @@
from __future__ import annotations
__version__ = '1.2.2'
__version__ = '1.3.0'
import abc
import json
@@ -52,28 +52,32 @@ class BgUtilPTPBase(PoTokenProvider, abc.ABC):
def _get_attestation(self, webpage: str | None):
if not webpage:
return None
raw_challenge_data = self.ie._search_regex(
r'''(?sx)window\.ytAtR\s*=\s*(?P<raw_cd>(?P<q>['"])
(?:
\\.|
(?!(?P=q)).
)*
(?P=q))\s*;''',
webpage,
'raw challenge data',
default=None,
group='raw_cd',
)
att_txt = traverse_obj(
raw_challenge_data,
({js_to_json}, {json.loads}, {json.loads}, 'bgChallenge')
)
if not att_txt:
self.logger.warning(
'Failed to extract initial attestation from the webpage'
)
return None
return att_txt
raw_cd = (
traverse_obj(
self.ie._search_regex(
r'''(?sx)window\s*\.\s*ytAtN\s*\(\s*
(?P<js>\{.+?}\s*)
\s*\)\s*;''',
webpage,
'ytAtN challenge',
default=None),
({js_to_json}, {json.loads}, 'R'))
or traverse_obj(
self.ie._search_regex(
r'''(?sx)window\.ytAtR\s*=\s*(?P<raw_cd>(?P<q>['"])
(?:
\\.|
(?!(?P=q)).
)*
(?P=q))\s*;''',
webpage,
'ytAtR challenge',
default=None),
({js_to_json}, {json.loads})))
if att_txt := traverse_obj(raw_cd, ({json.loads}, 'bgChallenge')):
return att_txt
self.logger.warning('Failed to extract initial attestation from the webpage')
return None
__all__ = ['__version__']