forked from rDrama/rDrama
fix snappy archiving images
parent
100677c1bb
commit
28786342dc
|
@ -215,9 +215,10 @@ def sanitize(sanitized, edit=False):
|
||||||
tag['alt'] = f'![]({tag["data-src"]})'
|
tag['alt'] = f'![]({tag["data-src"]})'
|
||||||
tag['referrerpolicy'] = "no-referrer"
|
tag['referrerpolicy'] = "no-referrer"
|
||||||
|
|
||||||
a = soup.new_tag("a", href=tag["data-src"], rel="nofollow noopener noreferrer")
|
if tag.parent.name != 'a':
|
||||||
tag = tag.replace_with(a)
|
a = soup.new_tag("a", href=tag["data-src"], rel="nofollow noopener noreferrer")
|
||||||
a.append(tag)
|
tag = tag.replace_with(a)
|
||||||
|
a.append(tag)
|
||||||
|
|
||||||
for tag in soup.find_all("a"):
|
for tag in soup.find_all("a"):
|
||||||
if tag.get("href") and fishylinks_regex.fullmatch(str(tag.string)):
|
if tag.get("href") and fishylinks_regex.fullmatch(str(tag.string)):
|
||||||
|
|
|
@ -1135,9 +1135,10 @@ def submit_post(v, sub=None):
|
||||||
gevent.spawn(archiveorg, newposturl)
|
gevent.spawn(archiveorg, newposturl)
|
||||||
|
|
||||||
captured = []
|
captured = []
|
||||||
for i in list(snappy_url_regex.finditer(post.body_html)):
|
body_for_snappy = post.body_html.replace(' data-src="', ' src="')
|
||||||
if i.group(0) in captured: continue
|
for i in list(snappy_url_regex.finditer(body_for_snappy)):
|
||||||
captured.append(i.group(0))
|
if i.group(1) in captured: continue
|
||||||
|
captured.append(i.group(1))
|
||||||
|
|
||||||
href = i.group(1)
|
href = i.group(1)
|
||||||
if not href: continue
|
if not href: continue
|
||||||
|
|
Loading…
Reference in New Issue