Use TwitterBot user agent (lie)
This commit is contained in:
parent
f44dbeec01
commit
ab3dd09251
1 changed files with 2 additions and 4 deletions
|
@ -232,16 +232,14 @@ def preview_url(
|
||||||
try:
|
try:
|
||||||
with httpx.Client(
|
with httpx.Client(
|
||||||
headers={
|
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,
|
timeout=60,
|
||||||
follow_redirects=False
|
follow_redirects=False
|
||||||
) as client:
|
) as client:
|
||||||
response = client.get(
|
response = client.get(
|
||||||
url,
|
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):
|
if response.status_code not in range(200, 400):
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
Loading…
Reference in a new issue