Skip to content

Commit

Permalink
fix cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
MainKronos committed Apr 4, 2023
1 parent 8c2ff74 commit 522c9eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions animeworld/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ def __init__(self) -> None:
self.fixCookie()

def fixCookie(self):
AWCookieVerify = re.compile(br'document\.cookie="AWCookieVerify=(.+) ;')
SecurityAW = re.compile(br'document\.cookie="SecurityAW=(.+) ;')
csrf_token = re.compile(br'<meta.*?id="csrf-token"\s*?content="(.*?)">')

for _ in range(2): # numero di tentativi
res = self.get("https://www.animeworld.tv")

m = AWCookieVerify.search(res.content)
m = SecurityAW.search(res.content)
if m:
self.cookies.update({'AWCookieVerify': m.group(1).decode('utf-8')})
self.cookies.update({'SecurityAW': m.group(1).decode('utf-8')})
continue

m = csrf_token.search(res.content)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="animeworld",
version="1.5.0",
version="1.5.1",
author="MainKronos",
description="AnimeWorld UNOFFICIAL API",
long_description=long_description,
Expand Down

0 comments on commit 522c9eb

Please sign in to comment.