forked from rDrama/rDrama
rename handle_youtube to handle_youtube_links
parent
9eab5308f3
commit
b31405c23d
|
@ -237,7 +237,7 @@ chud_images = listdir("files/assets/images/chud")
|
|||
chud_images = [f'![](/i/chud/{f})' for f in chud_images]
|
||||
chud_images.extend([':#trumpjaktalking:', ':#reposthorse:'])
|
||||
|
||||
def handle_youtube(url):
|
||||
def handle_youtube_links(url):
|
||||
html = None
|
||||
params = parse_qs(urlparse(url).query, keep_blank_values=True)
|
||||
id = params.get('v')[0]
|
||||
|
@ -383,7 +383,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
|
|||
if i.group(0) in captured: continue
|
||||
captured.append(i.group(0))
|
||||
|
||||
html = handle_youtube(i.group(0))
|
||||
html = handle_youtube_links(i.group(0))
|
||||
if html:
|
||||
sanitized = sanitized.replace(i.group(0), html)
|
||||
|
||||
|
|
|
@ -631,7 +631,7 @@ def submit_post(v:User, sub=None):
|
|||
embed = embed.replace('<a href', '<a rel="nofollow noopener" href')
|
||||
except: pass
|
||||
elif url.startswith('https://youtube.com/watch?'):
|
||||
embed = handle_youtube(url)
|
||||
embed = handle_youtube_links(url)
|
||||
elif SITE in domain and "/post/" in url and "context" not in url and url.count('/') < 6:
|
||||
id = url.split("/post/")[1]
|
||||
if "/" in id: id = id.split("/")[0]
|
||||
|
|
Loading…
Reference in New Issue