forked from rDrama/rDrama
fix "I stand with israel" and "I say this as a feminist ally" again lol
parent
3d1b8b26d1
commit
21e0fa0bc6
|
@ -633,10 +633,11 @@ def complies_with_chud(obj):
|
||||||
if obj.parent_submission in ADMIGGER_THREADS: return True
|
if obj.parent_submission in ADMIGGER_THREADS: return True
|
||||||
if obj.post.sub == "chudrama": return True
|
if obj.post.sub == "chudrama": return True
|
||||||
|
|
||||||
#get body_html's soup
|
#perserve old body_html to be used in checking for chud phrase
|
||||||
soup = BeautifulSoup(obj.body_html, 'lxml')
|
old_body_html = obj.body_html
|
||||||
|
|
||||||
#torture body_html
|
#torture body_html
|
||||||
|
soup = BeautifulSoup(obj.body_html, 'lxml')
|
||||||
tags = soup.html.body.find_all(lambda tag: tag.name not in {'blockquote','codeblock','pre'} and tag.string, recursive=False)
|
tags = soup.html.body.find_all(lambda tag: tag.name not in {'blockquote','codeblock','pre'} and tag.string, recursive=False)
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
tag.string.replace_with(torture_ap(tag.string, obj.author.username))
|
tag.string.replace_with(torture_ap(tag.string, obj.author.username))
|
||||||
|
@ -650,6 +651,7 @@ def complies_with_chud(obj):
|
||||||
|
|
||||||
#check for agendaposter_phrase in body_html
|
#check for agendaposter_phrase in body_html
|
||||||
excluded_tags = {'del','sub','sup','marquee','spoiler','lite-youtube','video','audio'}
|
excluded_tags = {'del','sub','sup','marquee','spoiler','lite-youtube','video','audio'}
|
||||||
|
soup = BeautifulSoup(old_body_html, 'lxml')
|
||||||
tags = soup.html.body.find_all(lambda tag: tag.name not in excluded_tags and not tag.attrs, recursive=False)
|
tags = soup.html.body.find_all(lambda tag: tag.name not in excluded_tags and not tag.attrs, recursive=False)
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
for text in tag.find_all(text=True, recursive=False):
|
for text in tag.find_all(text=True, recursive=False):
|
||||||
|
|
Loading…
Reference in New Issue