From ab3dd0925132476472af751d92e0aa4af68f2e49 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Thu, 22 Feb 2024 18:12:45 +0000 Subject: [PATCH] Use TwitterBot user agent (lie) --- server.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index 9212254..aa82349 100644 --- a/server.py +++ b/server.py @@ -232,16 +232,14 @@ def preview_url( try: with httpx.Client( headers={ - "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" + # "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" + "User-Agent": "TwitterBot/1.0" }, timeout=60, follow_redirects=False ) as client: response = client.get( url, - headers={ - "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" - }, ) if response.status_code not in range(200, 400): response.raise_for_status()