always use fake headers

pull/200/head
Aevann 2023-09-09 20:06:26 +03:00
parent 671c9024b1
commit 6f88ef72f9
3 changed files with 3 additions and 3 deletions

View File

@ -24,4 +24,4 @@ def giphy(v, path=None):
url = f"https://api.giphy.com/v1/gifs/search?q={searchTerm}&api_key={GIPHY_KEY}&limit=48"
else:
url = f"https://api.giphy.com/v1/gifs?api_key={GIPHY_KEY}&limit=48"
return requests.get(url, timeout=5).json()
return requests.get(url, headers=HEADERS, timeout=5).json()

View File

@ -495,7 +495,7 @@ def submit_post(v, sub=None):
domain = tldextract.extract(url).registered_domain
if domain == "twitter.com":
try:
embed = requests.get("https://publish.twitter.com/oembed", params={"url":url, "omit_script":"t"}, timeout=5).json()["html"]
embed = requests.get("https://publish.twitter.com/oembed", params={"url":url, "omit_script":"t"}, headers=HEADERS, timeout=5).json()["html"]
embed = embed.replace('<a href', '<a rel="nofollow noopener" href')
except: pass
elif url.startswith('https://youtube.com/watch?'):

View File

@ -863,7 +863,7 @@ def settings_song_change(v):
if YOUTUBE_KEY != DEFAULT_CONFIG_VALUE:
req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails", timeout=5).json()
req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails", headers=HEADERS, timeout=5).json()
try:
duration = req['items'][0]['contentDetails']['duration']