diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 3e8a74871..907f9434b 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -217,7 +217,7 @@ def sanitize(sanitized, noimages=False): for i in re.finditer('" target="_blank">(https://youtube\.com/watch\?v\=(.*?))', sanitized): url = i.group(1) - yt_id = i.group(2).split('&')[0] + yt_id = i.group(2).split('&')[0].split('%')[0] replacing = f'{url}' params = parse_qs(urlparse(url).query) diff --git a/files/routes/posts.py b/files/routes/posts.py index ac138656f..c27e6c90c 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -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"] except: embed = None 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) t = params.get('t', params.get('start', [0]))[0] if isinstance(t, str): t = t.replace('s','')