forked from MarseyWorld/MarseyWorld
fdssfd
parent
473302e161
commit
2fe2b8ac8e
|
@ -217,7 +217,7 @@ def sanitize(sanitized, noimages=False):
|
||||||
|
|
||||||
for i in re.finditer('" target="_blank">(https://youtube\.com/watch\?v\=(.*?))</a>', sanitized):
|
for i in re.finditer('" target="_blank">(https://youtube\.com/watch\?v\=(.*?))</a>', sanitized):
|
||||||
url = i.group(1)
|
url = i.group(1)
|
||||||
yt_id = i.group(2).split('&')[0]
|
yt_id = i.group(2).split('&')[0].split('%')[0]
|
||||||
replacing = f'<a href="{url}" rel="nofollow noopener noreferrer" target="_blank">{url}</a>'
|
replacing = f'<a href="{url}" rel="nofollow noopener noreferrer" target="_blank">{url}</a>'
|
||||||
|
|
||||||
params = parse_qs(urlparse(url).query)
|
params = parse_qs(urlparse(url).query)
|
||||||
|
|
|
@ -734,7 +734,7 @@ 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 url.startswith('https://youtube.com/watch?v='):
|
elif url.startswith('https://youtube.com/watch?v='):
|
||||||
yt_id = url.split('https://youtube.com/watch?v=')[1].split('&')[0]
|
yt_id = url.split('https://youtube.com/watch?v=')[1].split('&')[0].split('%')[0]
|
||||||
params = parse_qs(urlparse(url).query)
|
params = parse_qs(urlparse(url).query)
|
||||||
t = params.get('t', params.get('start', [0]))[0]
|
t = params.get('t', params.get('start', [0]))[0]
|
||||||
if isinstance(t, str): t = t.replace('s','')
|
if isinstance(t, str): t = t.replace('s','')
|
||||||
|
|
Loading…
Reference in New Issue