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.wsgi_app = ProxyFix(app.wsgi_app, x_for=3)
|
||||||
app.url_map.strict_slashes = False
|
app.url_map.strict_slashes = False
|
||||||
app.jinja_env.cache = {}
|
app.jinja_env.cache = {}
|
||||||
# import faulthandler
|
import faulthandler
|
||||||
# faulthandler.enable()
|
faulthandler.enable()
|
||||||
|
|
||||||
app.config["SITE_NAME"]=environ.get("SITE_NAME").strip()
|
app.config["SITE_NAME"]=environ.get("SITE_NAME").strip()
|
||||||
app.config["COINS_NAME"]=environ.get("COINS_NAME").strip()
|
app.config["COINS_NAME"]=environ.get("COINS_NAME").strip()
|
||||||
|
|
|
@ -698,14 +698,13 @@ def submit_post(v):
|
||||||
except: embed = None
|
except: embed = None
|
||||||
|
|
||||||
elif "youtu" in domain:
|
elif "youtu" in domain:
|
||||||
try: yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2)
|
try:
|
||||||
except: embed = None
|
yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2)
|
||||||
if not yt_id or len(yt_id) != 11: embed = None
|
|
||||||
else:
|
|
||||||
params = parse_qs(urlparse(url).query)
|
params = parse_qs(urlparse(url).query)
|
||||||
t = params.get('t', params.get('start', [0]))[0]
|
t = params.get('t', params.get('start', [0]))[0]
|
||||||
if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}"
|
if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}"
|
||||||
else: embed = f"https://youtube.com/embed/{yt_id}"
|
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:
|
elif app.config['SERVER_NAME'] in domain and "/post/" in url and "context" not in url:
|
||||||
id = url.split("/post/")[1]
|
id = url.split("/post/")[1]
|
||||||
|
|
Loading…
Reference in New Issue