diff options
author | Allen <64094914+allendema@users.noreply.github.com> | 2024-05-23 23:21:58 +0000 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-05-29 17:56:17 +0200 |
commit | 0fa81fc782feb104bbd6616d87a6f441aad7d5bd (patch) | |
tree | 4fd2f697240307d616f8b49614787852e5923fc4 /searx/engines/vimeo.py | |
parent | 0fb3f0e4aeecf62612cb6568910cf0f97c98cab9 (diff) | |
download | searxng-0fa81fc782feb104bbd6616d87a6f441aad7d5bd.tar.gz searxng-0fa81fc782feb104bbd6616d87a6f441aad7d5bd.zip |
[enh] add re-usable func to filter text
Diffstat (limited to 'searx/engines/vimeo.py')
-rw-r--r-- | searx/engines/vimeo.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/engines/vimeo.py b/searx/engines/vimeo.py index 2449345e6..d46468d8d 100644 --- a/searx/engines/vimeo.py +++ b/searx/engines/vimeo.py @@ -7,6 +7,8 @@ from urllib.parse import urlencode from json import loads from dateutil import parser +from searx.utils import extr + # about about = { "website": 'https://vimeo.com/', @@ -23,7 +25,7 @@ paging = True # search-url base_url = 'https://vimeo.com/' -search_url = base_url + '/search/page:{pageno}?{query}' +search_url = base_url + 'search/page:{pageno}?{query}' # do search-request @@ -36,9 +38,8 @@ def request(query, params): # get response from search-request def response(resp): results = [] - data_start_pos = resp.text.find('{"filtered"') - data_end_pos = resp.text.find(';\n', data_start_pos + 1) - data = loads(resp.text[data_start_pos:data_end_pos]) + + data = loads(extr(resp.text, 'var data = ', ';\n')) # parse results for result in data['filtered']['data']: |