mirror of
https://github.com/searxng/searxng.git
synced 2025-08-02 10:02:20 +02:00
[enh] add re-usable func to filter text
This commit is contained in:
parent
0fb3f0e4ae
commit
0fa81fc782
6 changed files with 53 additions and 25 deletions
|
@ -312,13 +312,12 @@ def fetch_traits(engine_traits: EngineTraits):
|
|||
# pylint: disable=import-outside-toplevel
|
||||
from searx import network
|
||||
from searx.locales import region_tag
|
||||
from searx.utils import extr
|
||||
|
||||
resp = network.get(about['website'])
|
||||
text = resp.text
|
||||
text = text[text.find('INITIAL_PROPS') :]
|
||||
text = text[text.find('{') : text.find('</script>')]
|
||||
json_string = extr(resp.text, 'INITIAL_PROPS = ', '</script>')
|
||||
|
||||
q_initial_props = loads(text)
|
||||
q_initial_props = loads(json_string)
|
||||
q_locales = q_initial_props.get('locales')
|
||||
eng_tag_list = set()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue