Updated ad/sponsored content filter and conf naming
Configs are now named with a .conf extension to allow for easier manual cleanup/modification of named config files Sponsored content now removed by basic string matching of span content
This commit is contained in:
parent
b73579a11d
commit
cdd5e1a78e
|
@ -47,6 +47,10 @@ def filter_link_args(query_link):
|
|||
return query_link
|
||||
|
||||
|
||||
def has_ad_content(element):
|
||||
return element == 'ad' or element == 'sponsoredⓘ'
|
||||
|
||||
|
||||
class Filter:
|
||||
def __init__(self, user_keys: dict, mobile=False, config=None):
|
||||
if config is None:
|
||||
|
@ -132,7 +136,7 @@ class Filter:
|
|||
return
|
||||
|
||||
for div in [_ for _ in self.main_divs.find_all('div', recursive=True)]:
|
||||
has_ad = len([_ for _ in div.find_all('span', recursive=True) if 'ad' == _.text.lower()])
|
||||
has_ad = len([_ for _ in div.find_all('span', recursive=True) if has_ad_content(_.text.lower())])
|
||||
_ = div.decompose() if has_ad else None
|
||||
|
||||
def fix_question_section(self):
|
||||
|
|
|
@ -80,7 +80,7 @@ const loadConfig = event => {
|
|||
}
|
||||
|
||||
let xhrPUT = new XMLHttpRequest();
|
||||
xhrPUT.open("PUT", "/config?name=" + config);
|
||||
xhrPUT.open("PUT", "/config?name=" + config + ".conf");
|
||||
xhrPUT.onload = function() {
|
||||
if (xhrPUT.readyState === 4 && xhrPUT.status !== 200) {
|
||||
alert("Error loading Whoogle config");
|
||||
|
@ -102,7 +102,7 @@ const saveConfig = event => {
|
|||
}
|
||||
|
||||
let configForm = document.getElementById("config-form");
|
||||
configForm.action = '/config?name=' + config;
|
||||
configForm.action = '/config?name=' + config + ".conf";
|
||||
configForm.submit();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user