forked from rDrama/rDrama
1
0
Fork 0

fix 500 error

master
Aevann 2023-08-05 22:26:17 +03:00
parent fe5acdddd9
commit a3a29408f4
1 changed files with 2 additions and 1 deletions

View File

@ -473,7 +473,8 @@ def submit_post(v, sub=None):
if url.startswith(x.domain):
abort(400, f'Remove the banned link "{x.domain}" and try again!\nReason for link ban: "{x.reason}"')
if "twitter.com" == domain:
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 = embed.replace('<a href', '<a rel="nofollow noopener" href')