forked from MarseyWorld/MarseyWorld
fdsfs
parent
d666bfaa95
commit
b03f2066ee
|
@ -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()
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue