From ce4b4782697bdc60da3365a59af3c9a300dbbe15 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 3 Aug 2021 20:57:04 +0200 Subject: [PATCH] fdfd --- drama/routes/posts.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drama/routes/posts.py b/drama/routes/posts.py index b5ae29edf..1a574b59c 100644 --- a/drama/routes/posts.py +++ b/drama/routes/posts.py @@ -619,11 +619,13 @@ def submit_post(v): embed = requests.get("https://graph.facebook.com/v9.0/instagram_oembed", params={"url":url,"access_token":environ.get("FACEBOOK_TOKEN","").strip(),"omitscript":'true'}, headers={"User-Agent":"Instagram embedder for Drama"}).json()["html"] elif app.config['SERVER_NAME'] in domain: - matches = re.match(re.compile(f"^.*{domain}/post/+\w+/(\w+)(/\w+/(\w+))?"), url) - post_id = matches.group(1) - comment_id = matches.group(3) - if comment_id: embed = f"https://{app.config['SERVER_NAME']}/embed/comment/{comment_id}" - else: embed = f"https://{app.config['SERVER_NAME']}/embed/post/{post_id}" + try: + matches = re.match(re.compile(f"^.*{domain}/post/+\w+/(\w+)(/\w+/(\w+))?"), url) + post_id = matches.group(1) + comment_id = matches.group(3) + if comment_id: embed = f"https://{app.config['SERVER_NAME']}/embed/comment/{comment_id}" + else: embed = f"https://{app.config['SERVER_NAME']}/embed/post/{post_id}" + except: embed = None else: embed = None