From b03f2066ee5e6591fbe34497b6f933d8a3740c03 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 21:06:02 +0200 Subject: [PATCH] fdsfs --- files/__main__.py | 4 ++-- files/routes/posts.py | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index b4cd5a8bc..aa2845651 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -19,8 +19,8 @@ app = Flask(__name__, template_folder='./templates') app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3) app.url_map.strict_slashes = False app.jinja_env.cache = {} -# import faulthandler -# faulthandler.enable() +import faulthandler +faulthandler.enable() app.config["SITE_NAME"]=environ.get("SITE_NAME").strip() app.config["COINS_NAME"]=environ.get("COINS_NAME").strip() diff --git a/files/routes/posts.py b/files/routes/posts.py index bc513325e..438794b1a 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -698,14 +698,13 @@ def submit_post(v): except: embed = None elif "youtu" in domain: - try: yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2) - except: embed = None - if not yt_id or len(yt_id) != 11: embed = None - else: + try: + 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) t = params.get('t', params.get('start', [0]))[0] if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}" 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: id = url.split("/post/")[1]