add 2 slurs filter items
parent
d9553d2636
commit
f7e2c21ae9
|
@ -191,9 +191,15 @@ if SITE_NAME == 'rDrama':
|
||||||
" cool (?!it)": " fetch ",
|
" cool (?!it)": " fetch ",
|
||||||
"krayon": "krayon (sister toucher)",
|
"krayon": "krayon (sister toucher)",
|
||||||
"discord": "groomercord",
|
"discord": "groomercord",
|
||||||
|
"allah(?! \()": "Allah (ﷻ)",
|
||||||
|
"muhammad(?! \()": "Prophet Muhammad (ﷺ)"
|
||||||
}
|
}
|
||||||
SLURS.update(RDRAMA_SLURS)
|
SLURS.update(RDRAMA_SLURS)
|
||||||
|
|
||||||
|
SLURS_FOR_REPLACING = {}
|
||||||
|
for k, val in SLURS.items():
|
||||||
|
SLURS_FOR_REPLACING[k.split('(')[0]] = val
|
||||||
|
|
||||||
BOOSTED_SITES = {
|
BOOSTED_SITES = {
|
||||||
#youtube-like
|
#youtube-like
|
||||||
'bitchute.com',
|
'bitchute.com',
|
||||||
|
|
|
@ -119,24 +119,22 @@ knowledgebase_page_regex = re.compile("[a-zA-Z0-9_\-]+", flags=re.A)
|
||||||
|
|
||||||
html_title_regex = re.compile("<title>(.{1,200})</title>", flags=re.I)
|
html_title_regex = re.compile("<title>(.{1,200})</title>", flags=re.I)
|
||||||
|
|
||||||
def sub_matcher(match:re.Match, upper=False, replace_with:Union[dict[str, str], dict[str, List[str]]]=SLURS):
|
def sub_matcher(match:re.Match, upper=False, replace_with:Union[dict[str, str], dict[str, List[str]]]=SLURS_FOR_REPLACING):
|
||||||
group_num = 0
|
group_num = 0
|
||||||
match_str = match.group(group_num)
|
match_str = match.group(group_num)
|
||||||
if match_str.startswith('<'):
|
if match_str.startswith('<'):
|
||||||
return match_str
|
return match_str
|
||||||
elif match_str.lower() == ' cool ':
|
|
||||||
return ' fetch '
|
|
||||||
else:
|
else:
|
||||||
repl = replace_with[match_str.lower()]
|
repl = replace_with[match_str.lower()]
|
||||||
return repl if not upper or "<img" in repl else repl.upper()
|
return repl if not upper or "<img" in repl else repl.upper()
|
||||||
|
|
||||||
def sub_matcher_upper(match, replace_with:Union[dict[str, str], dict[str, List[str]]]=SLURS):
|
def sub_matcher_upper(match, replace_with:Union[dict[str, str], dict[str, List[str]]]=SLURS_FOR_REPLACING):
|
||||||
return sub_matcher(match, upper=True, replace_with=replace_with)
|
return sub_matcher(match, upper=True, replace_with=replace_with)
|
||||||
|
|
||||||
|
|
||||||
# TODO: make censoring a bit better
|
# TODO: make censoring a bit better
|
||||||
def sub_matcher_slurs(match, upper=False):
|
def sub_matcher_slurs(match, upper=False):
|
||||||
return sub_matcher(match, upper, replace_with=SLURS)
|
return sub_matcher(match, upper, replace_with=SLURS_FOR_REPLACING)
|
||||||
|
|
||||||
def sub_matcher_slurs_upper(match):
|
def sub_matcher_slurs_upper(match):
|
||||||
return sub_matcher_slurs(match, upper=True)
|
return sub_matcher_slurs(match, upper=True)
|
||||||
|
|
Loading…
Reference in New Issue