Clean "Show more results" of all site blocks (#646)

このコミットが含まれているのは:
DUO Labs 2022-02-08 12:57:00 -05:00 committed by GitHub
コミット 502067addc
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 4AEE18F83AFDEB23
1個のファイルの変更12行の追加1行の削除

ファイルの表示

@ -119,9 +119,20 @@ 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
search_string = ' '.join(['-site:' +
_ for _ in self.config.block.split(',')])
selected = soup.body.findAll(text=re.compile(search_string))
for result in selected:
result.string.replace_with(result.string.replace(
search_string, ''))
def remove_ads(self) -> None:
"""Removes ads found in the list of search result divs