Updated to remove ads, minor renaming refactor
parent
24aa4367d3
commit
d90468c667
|
@ -70,11 +70,16 @@ def search():
|
|||
full_query = url_parse(q) + tbm + start + near
|
||||
|
||||
get_body = send_request(SEARCH_URL + full_query, get_ua(user_agent))
|
||||
get_body = get_body.replace('>G<', '>Bl<')
|
||||
get_body = get_body.replace('>G<', '>Sh<')
|
||||
pattern = re.compile('4285f4|ea4335|fbcc05|34a853|fbbc05', re.IGNORECASE)
|
||||
get_body = pattern.sub('0000ff', get_body)
|
||||
|
||||
soup = BeautifulSoup(get_body, 'html.parser')
|
||||
|
||||
ad_divs = soup.find('div', {'id':'main'}).findAll('div', {'class':'ZINbbc'}, recursive=False)
|
||||
for div in ad_divs:
|
||||
div.decompose()
|
||||
|
||||
for a in soup.find_all('a', href=True):
|
||||
href = a['href']
|
||||
if 'url?q=' in href:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
<link rel="search" href="/static/opensearch.xml" type="application/opensearchdescription+xml" title="Bloogle Search">
|
||||
<link rel="search" href="/static/opensearch.xml" type="application/opensearchdescription+xml" title="Shoogle Search">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="/static/js/controller.js"></script>
|
||||
<link rel="stylesheet" href="/static/css/main.css">
|
||||
|
|
Loading…
Reference in New Issue