From 543f2b2a01d82dff1691e287bb0fe5956aad7180 Mon Sep 17 00:00:00 2001 From: DUO Labs Date: Tue, 26 Oct 2021 12:35:12 -0400 Subject: [PATCH] Add a "minimal mode" for condensing results (#485) If WHOOGLE_MINIMAL is set, all non-link results are removed from the view. --- app/filter.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/filter.py b/app/filter.py index 8f241e5..090753b 100644 --- a/app/filter.py +++ b/app/filter.py @@ -7,6 +7,8 @@ from flask import render_template import re import urllib.parse as urlparse 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: @@ -186,8 +188,12 @@ class Filter: # Loop through results and check for the number of child divs in each for result in self.main_divs: result_children = pull_child_divs(result) - if len(result_children) < self.RESULT_CHILD_LIMIT: - continue + if read_config_bool('WHOOGLE_MINIMAL'): + if len(result_children) in (1, 3): + continue + else: + if len(result_children) < self.RESULT_CHILD_LIMIT: + continue # Find and decompose the first element with an inner HTML text val. # This typically extracts the title of the section (i.e. "Related