Fixed filter params, updated search button text
parent
5fe308956b
commit
dcd93d4869
|
@ -54,6 +54,8 @@ class Filter:
|
||||||
|
|
||||||
def remove_ads(self, soup):
|
def remove_ads(self, soup):
|
||||||
main_divs = soup.find('div', {'id': 'main'})
|
main_divs = soup.find('div', {'id': 'main'})
|
||||||
|
if main_divs is None:
|
||||||
|
return
|
||||||
result_divs = main_divs.find_all('div', recursive=False)
|
result_divs = main_divs.find_all('div', recursive=False)
|
||||||
|
|
||||||
# Only ads/sponsored content use classes in the list of result divs
|
# Only ads/sponsored content use classes in the list of result divs
|
||||||
|
@ -114,9 +116,8 @@ class Filter:
|
||||||
new_search = '/search?q=' + enc_result.decode()
|
new_search = '/search?q=' + enc_result.decode()
|
||||||
|
|
||||||
query_params = parse_qs(urlparse.urlparse(href).query)
|
query_params = parse_qs(urlparse.urlparse(href).query)
|
||||||
allowed_params = [_ for _ in query_params if _ in VALID_PARAMS]
|
for param in VALID_PARAMS:
|
||||||
for param in allowed_params:
|
param_val = query_params[param][0] if param in query_params else ''
|
||||||
param_val = query_params[param][0]
|
|
||||||
new_search += '&' + param + '=' + param_val
|
new_search += '&' + param + '=' + param_val
|
||||||
a['href'] = new_search
|
a['href'] = new_search
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<form action="/search" method="post">
|
<form action="/search" method="post">
|
||||||
<div class="search-fields">
|
<div class="search-fields">
|
||||||
<input type="text" name="q" id="search-bar">
|
<input type="text" name="q" id="search-bar">
|
||||||
<input type="submit" id="search-submit" value="Submit">
|
<input type="submit" id="search-submit" value="Search">
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
Loading…
Reference in New Issue