Use TwitterBot user agent (lie)

This commit is contained in:
Nexus 2024-02-22 18:12:45 +00:00
parent f44dbeec01
commit ab3dd09251
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -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()