Clean "Show more results" of all site blocks

This commit is contained in:
DUO Labs 2022-02-07 17:40:11 -05:00 committed by GitHub
parent 11099f7b1d
commit d13d17b683
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,9 +119,16 @@ class Filter:
header = soup.find('header')
if header:
header.decompose()
self.remove_site_blocks(soup)
return soup
def remove_site_blocks(self,soup) -> None:
if not self.config.block:
return
selected=soup.body.findAll(text=re.compile(' '.join(['-site:'+_ for _ in self.config.block.split(',')])))
for result in selected:
result.string.replace_with(result.string.replace(' '.join(['-site:'+_ for _ in self.config.block.split(',')]),''))
def remove_ads(self) -> None:
"""Removes ads found in the list of search result divs