forked from rDrama/rDrama
Merge branch 'master' of https://github.com/Aevann1/Drama
commit
6eabc53edf
|
@ -210,7 +210,10 @@ def sanitize(sanitized, noimages=False):
|
||||||
start = '<s>'
|
start = '<s>'
|
||||||
end = '</s>'
|
end = '</s>'
|
||||||
|
|
||||||
if not session.get("favorite_emojis"): session["favorite_emojis"] = {}
|
try:
|
||||||
|
if not session.get("favorite_emojis"): session["favorite_emojis"] = {}
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
if start in sanitized and end in sanitized and start in sanitized.split(end)[0] and end in sanitized.split(start)[1]: sanitized = sanitized.replace(start, '<span class="spoiler">').replace(end, '</span>')
|
if start in sanitized and end in sanitized and start in sanitized.split(end)[0] and end in sanitized.split(start)[1]: sanitized = sanitized.replace(start, '<span class="spoiler">').replace(end, '</span>')
|
||||||
|
|
||||||
|
@ -218,15 +221,21 @@ def sanitize(sanitized, noimages=False):
|
||||||
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'):
|
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'):
|
||||||
sanitized = sanitized.replace(f'<p>:{i.group(1)}:</p>', f'<p><img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=60 src="https://{site}/assets/images/emojis/{i.group(1)}.gif"</p>')
|
sanitized = sanitized.replace(f'<p>:{i.group(1)}:</p>', f'<p><img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=60 src="https://{site}/assets/images/emojis/{i.group(1)}.gif"</p>')
|
||||||
|
|
||||||
if i.group(1) in session["favorite_emojis"]: session["favorite_emojis"][i.group(1)] += 1
|
try:
|
||||||
else: session["favorite_emojis"][i.group(1)] = 1
|
if i.group(1) in session["favorite_emojis"]: session["favorite_emojis"][i.group(1)] += 1
|
||||||
|
else: session["favorite_emojis"][i.group(1)] = 1
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
for i in re.finditer(':([^ ]{1,30}?):', sanitized):
|
for i in re.finditer(':([^ ]{1,30}?):', sanitized):
|
||||||
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'):
|
if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'):
|
||||||
sanitized = sanitized.replace(f':{i.group(1)}:', f'<img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=30 src="https://{site}/assets/images/emojis/{i.group(1)}.gif"<span>')
|
sanitized = sanitized.replace(f':{i.group(1)}:', f'<img loading="lazy" data-toggle="tooltip" title="{i.group(1)}" delay="0" height=30 src="https://{site}/assets/images/emojis/{i.group(1)}.gif"<span>')
|
||||||
|
|
||||||
if i.group(1) in session["favorite_emojis"]: session["favorite_emojis"][i.group(1)] += 1
|
try:
|
||||||
else: session["favorite_emojis"][i.group(1)] = 1
|
if i.group(1) in session["favorite_emojis"]: session["favorite_emojis"][i.group(1)] += 1
|
||||||
|
else: session["favorite_emojis"][i.group(1)] = 1
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.", "https://").replace("https://m.", "https://")
|
sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.", "https://").replace("https://m.", "https://")
|
||||||
|
|
|
@ -3,6 +3,7 @@ from urllib.parse import urlparse
|
||||||
import mistletoe
|
import mistletoe
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import gevent
|
import gevent
|
||||||
|
import traceback
|
||||||
|
|
||||||
from files.helpers.wrappers import *
|
from files.helpers.wrappers import *
|
||||||
from files.helpers.sanitize import *
|
from files.helpers.sanitize import *
|
||||||
|
@ -565,7 +566,9 @@ def check_processing_thread(v, post, link, db):
|
||||||
elif status == 'failed':
|
elif status == 'failed':
|
||||||
print(f"video upload for post {post.id} failed")
|
print(f"video upload for post {post.id} failed")
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
traceback.print_exc()
|
||||||
|
print("retard. aborting thread")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue