remotes/1693045480750635534/spooky-22
Aevann1 2021-08-22 21:51:43 +02:00
parent e38417dd9a
commit 857ea84016
1 changed files with 0 additions and 7 deletions

View File

@ -173,13 +173,6 @@ def sanitize(sanitized):
sanitized = sanitized.replace(f':{i.group(1)}:', f'<img 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("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=")
if '" rel="nofollow noopener" target="_blank">https://youtube.com/watch?v=' in sanitized:
sanitized = sanitized.replace("watch?v=", "embed/")
url = re.search('(https://youtube.com/embed/.*?)"', sanitized).group(1)
replacing = f'<p><a href="{url}" rel="nofollow noopener" target="_blank">{url}</a></p>'
htmlsource = f'<div style="padding-top:5px; padding-bottom: 10px;"><iframe allowfullscreen="" frameborder="0" src="{url}"></iframe></div>'
sanitized = sanitized.replace(replacing, htmlsource)
for i in re.finditer('" target="_blank">(https://youtube.com/watch\?v\=.*?)</a>', sanitized):
url = i.group(1)