mirror of
https://github.com/benbusby/whoogle-search.git
synced 2025-07-09 03:04:13 -04:00
Added filtering of sponsored content
This commit is contained in:
parent
066c253c4d
commit
6a82f6e1ad
@ -99,11 +99,12 @@ def search():
|
||||
|
||||
soup = BeautifulSoup(get_body, 'html.parser')
|
||||
|
||||
# Remove all ads (TODO: Ad specific div class may change over time, look into a more generic method)
|
||||
# Remove all ads (TODO: Ad specific div classes probably change over time, look into a more generic method)
|
||||
main_divs = soup.find('div', {'id': 'main'})
|
||||
if main_divs is not None:
|
||||
ad_divs = main_divs.findAll('div', {'class': 'ZINbbc'}, recursive=False)
|
||||
for div in ad_divs:
|
||||
sponsored_divs = main_divs.findAll('div', {'class': 'D1fz0e'}, recursive=False)
|
||||
for div in ad_divs + sponsored_divs:
|
||||
div.decompose()
|
||||
|
||||
# Remove unnecessary button(s)
|
||||
|
Loading…
x
Reference in New Issue
Block a user