forked from rDrama/rDrama
fdfd
parent
933deb10d6
commit
ac42193546
|
@ -603,8 +603,9 @@ def submit_post(v):
|
||||||
else: return render_template("submit.html", v=v, error="ToS Violation", title=title, url=url, body=request.form.get("body", "")), 400
|
else: return render_template("submit.html", v=v, error="ToS Violation", title=title, url=url, body=request.form.get("body", "")), 400
|
||||||
|
|
||||||
if "twitter.com" in domain:
|
if "twitter.com" in domain:
|
||||||
embed = requests.get("https://publish.twitter.com/oembed", params={"url":url, "omit_script":"t"}).json()["html"]
|
try: embed = requests.get("https://publish.twitter.com/oembed", params={"url":url, "omit_script":"t"}).json()["html"]
|
||||||
|
except: pass
|
||||||
|
|
||||||
elif "youtu" in domain:
|
elif "youtu" in domain:
|
||||||
yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2)
|
yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2)
|
||||||
if not yt_id or len(yt_id) != 11: embed = None
|
if not yt_id or len(yt_id) != 11: embed = None
|
||||||
|
|
Loading…
Reference in New Issue