From 051909ba860cc2cd73f14f7cf7a13854ecaaafd1 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 17 May 2024 23:06:59 +0100 Subject: [PATCH] Properly get guest token --- twExtract/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twExtract/__init__.py b/twExtract/__init__.py index 9e367ba..34c542a 100644 --- a/twExtract/__init__.py +++ b/twExtract/__init__.py @@ -38,7 +38,7 @@ def getGuestToken(): global guestToken global guestTokenUses if guestToken is None: - r = requests.get(f"https://{twitterUrl}",headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0"}) + r = requests.get(f"https://{twitterUrl}",headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0","Cookie":"night_mode=2"},allow_redirects=False) m = re.search(gt_pattern, r.text) if m is None: r = requests.post(f"https://api.{twitterUrl}/1.1/guest/activate.json", headers={"Authorization":v2Bearer})