Small change
This commit is contained in:
parent
34bf93c2d5
commit
3dc940ac53
@ -1234,20 +1234,33 @@ class Amazon(BaseService):
|
||||
"""
|
||||
try:
|
||||
res = self.session.get(self.endpoints["ontv"])
|
||||
response = res.text
|
||||
if 'input type="hidden" name="appAction" value="SIGNIN"' in response:
|
||||
raise self.log.exit(
|
||||
"Cookies are signed out, cannot get ontv CSRF token. "
|
||||
f"Expecting profile to have cookies for: {self.endpoints['ontv']}"
|
||||
)
|
||||
for match in re.finditer(r"<script type=\"text/template\">(.+)</script>", response):
|
||||
prop = json.loads(match.group(1))
|
||||
prop = prop.get("props", {}).get("codeEntry", {}).get("token")
|
||||
if prop:
|
||||
return prop
|
||||
raise self.log.exit(f"Unable to get ontv CSRF token - Navigate to {self.endpoints['ontv']}, login and save cookies from that page to default.txt")
|
||||
except:
|
||||
res = self.session.get(self.endpoints["ontvold"])
|
||||
response = res.text
|
||||
if 'input type="hidden" name="appAction" value="SIGNIN"' in response:
|
||||
raise self.log.exit(
|
||||
"Cookies are signed out, cannot get ontv CSRF token. "
|
||||
f"Expecting profile to have cookies for: {self.endpoints['ontv']}"
|
||||
)
|
||||
for match in re.finditer(r"<script type=\"text/template\">(.+)</script>", response):
|
||||
prop = json.loads(match.group(1))
|
||||
prop = prop.get("props", {}).get("codeEntry", {}).get("token")
|
||||
if prop:
|
||||
return prop
|
||||
raise self.log.exit(f"Unable to get ontv CSRF token - Navigate to {self.endpoints['ontv']}, login and save cookies from that page to default.txt")
|
||||
response = res.text
|
||||
if 'input type="hidden" name="appAction" value="SIGNIN"' in response:
|
||||
raise self.log.exit(
|
||||
"Cookies are signed out, cannot get ontv CSRF token. "
|
||||
f"Expecting profile to have cookies for: {self.endpoints['ontv']}"
|
||||
)
|
||||
for match in re.finditer(r"<script type=\"text/template\">(.+)</script>", response):
|
||||
prop = json.loads(match.group(1))
|
||||
prop = prop.get("props", {}).get("codeEntry", {}).get("token")
|
||||
if prop:
|
||||
return prop
|
||||
raise self.log.exit(f"Unable to get ontv CSRF token - Navigate to {self.endpoints['ontvold']}, login and save cookies from that page to default.txt")
|
||||
|
||||
|
||||
def get_code_pair(self, device: dict) -> dict:
|
||||
"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user