Add a "minimal mode" for condensing results (#485)
If WHOOGLE_MINIMAL is set, all non-link results are removed from the view.main
parent
5a05bfb6de
commit
543f2b2a01
|
@ -7,6 +7,8 @@ from flask import render_template
|
||||||
import re
|
import re
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
|
import os
|
||||||
|
from app.utils.misc import read_config_bool
|
||||||
|
|
||||||
|
|
||||||
def extract_q(q_str: str, href: str) -> str:
|
def extract_q(q_str: str, href: str) -> str:
|
||||||
|
@ -186,6 +188,10 @@ class Filter:
|
||||||
# Loop through results and check for the number of child divs in each
|
# Loop through results and check for the number of child divs in each
|
||||||
for result in self.main_divs:
|
for result in self.main_divs:
|
||||||
result_children = pull_child_divs(result)
|
result_children = pull_child_divs(result)
|
||||||
|
if read_config_bool('WHOOGLE_MINIMAL'):
|
||||||
|
if len(result_children) in (1, 3):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
if len(result_children) < self.RESULT_CHILD_LIMIT:
|
if len(result_children) < self.RESULT_CHILD_LIMIT:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue