master
Aevann1 2021-09-21 21:06:02 +02:00
parent d666bfaa95
commit b03f2066ee
2 changed files with 5 additions and 6 deletions

View File

@ -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()

View File

@ -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]