From 4c82ac7670bf7f420a8cd2e75a24fc1a8630a32c Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 19 Nov 2021 15:00:22 +0100 Subject: [PATCH 1/2] [drop] engine digg - https://digg.com/api is no longer available Signed-off-by: Markus Heiser --- searx/engines/digg.py | 69 ------------------------------------------- searx/settings.yml | 4 --- 2 files changed, 73 deletions(-) delete mode 100644 searx/engines/digg.py diff --git a/searx/engines/digg.py b/searx/engines/digg.py deleted file mode 100644 index e12cc43c8..000000000 --- a/searx/engines/digg.py +++ /dev/null @@ -1,69 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -# lint: pylint -""" - Digg (News, Social media) -""" - -from json import loads -from urllib.parse import urlencode -from datetime import datetime - -from lxml import html - -# about -about = { - "website": 'https://digg.com', - "wikidata_id": 'Q270478', - "official_api_documentation": None, - "use_official_api": False, - "require_api_key": False, - "results": 'HTML', -} - -# engine dependent config -categories = ['news', 'social media'] -paging = True -base_url = 'https://digg.com' - -# search-url -search_url = base_url + ( - '/api/search/' - '?{query}' - '&from={position}' - '&size=20' - '&format=html' -) - -def request(query, params): - offset = (params['pageno'] - 1) * 20 - params['url'] = search_url.format( - query = urlencode({'q': query}), - position = offset, - ) - return params - -def response(resp): - results = [] - - # parse results - for result in loads(resp.text)['mapped']: - - # strip html tags and superfluous quotation marks from content - content = html.document_fromstring( - result['excerpt'] - ).text_content() - - # 'created': {'ISO': '2020-10-16T14:09:55Z', ...} - published = datetime.strptime( - result['created']['ISO'], '%Y-%m-%dT%H:%M:%SZ' - ) - results.append({ - 'url': result['url'], - 'title': result['title'], - 'content' : content, - 'template': 'videos.html', - 'publishedDate': published, - 'thumbnail': result['images']['thumbImage'], - }) - - return results diff --git a/searx/settings.yml b/searx/settings.yml index 2bf238fde..a936364e6 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -406,10 +406,6 @@ engines: # timeout: 6.0 # disabled: true - - name: digg - engine: digg - shortcut: dg - - name: docker hub engine: docker_hub shortcut: dh From 86090e13d3a084f01b0f6f93e235915ae8e0f738 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 19 Nov 2021 15:06:42 +0100 Subject: [PATCH 2/2] [mod] enable reddit - to have at least one in category social-media Since digg no longer works, we do nat have a active engine in the social-media category. Enable reddit by default to have at least one engine back in this category. Signed-off-by: Markus Heiser --- searx/settings.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/searx/settings.yml b/searx/settings.yml index a936364e6..585b8a841 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -1137,8 +1137,6 @@ engines: engine: reddit shortcut: re page_size: 25 - timeout: 10.0 - disabled: true # Required dependency: redis # - name: myredis