forked from rDrama/rDrama
sdfsdf
parent
7c595fb548
commit
caeeb0ddde
|
@ -577,13 +577,11 @@ def submit_post(v):
|
||||||
try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"]
|
try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"]
|
||||||
except: embed = None
|
except: embed = None
|
||||||
elif "youtu" in domain:
|
elif "youtu" in domain:
|
||||||
try:
|
|
||||||
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)
|
||||||
params = parse_qs(urlparse(url).query)
|
params = parse_qs(urlparse(url).query)
|
||||||
t = params.get('t', params.get('start', [0]))[0].replace('s','')
|
t = params.get('t', params.get('start', [0]))[0].replace('s','')
|
||||||
if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}"
|
if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}"
|
||||||
else: embed = f"https://youtube.com/embed/{yt_id}"
|
else: embed = f"https://youtube.com/embed/{yt_id}"
|
||||||
except: embed = None
|
|
||||||
elif app.config['SERVER_NAME'] in domain and "/post/" in url and "context" not in url:
|
elif app.config['SERVER_NAME'] in domain and "/post/" in url and "context" not in url:
|
||||||
id = url.split("/post/")[1]
|
id = url.split("/post/")[1]
|
||||||
if "/" in id: id = id.split("/")[0]
|
if "/" in id: id = id.split("/")[0]
|
||||||
|
|
Loading…
Reference in New Issue