always use fake headers
parent
671c9024b1
commit
6f88ef72f9
|
@ -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"
|
url = f"https://api.giphy.com/v1/gifs/search?q={searchTerm}&api_key={GIPHY_KEY}&limit=48"
|
||||||
else:
|
else:
|
||||||
url = f"https://api.giphy.com/v1/gifs?api_key={GIPHY_KEY}&limit=48"
|
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()
|
||||||
|
|
|
@ -495,7 +495,7 @@ def submit_post(v, sub=None):
|
||||||
domain = tldextract.extract(url).registered_domain
|
domain = tldextract.extract(url).registered_domain
|
||||||
if domain == "twitter.com":
|
if domain == "twitter.com":
|
||||||
try:
|
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')
|
embed = embed.replace('<a href', '<a rel="nofollow noopener" href')
|
||||||
except: pass
|
except: pass
|
||||||
elif url.startswith('https://youtube.com/watch?'):
|
elif url.startswith('https://youtube.com/watch?'):
|
||||||
|
|
|
@ -863,7 +863,7 @@ def settings_song_change(v):
|
||||||
|
|
||||||
|
|
||||||
if YOUTUBE_KEY != DEFAULT_CONFIG_VALUE:
|
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:
|
try:
|
||||||
duration = req['items'][0]['contentDetails']['duration']
|
duration = req['items'][0]['contentDetails']['duration']
|
||||||
|
|
Loading…
Reference in New Issue