From 0f9694c90b012834400d11491a3c58790a857f6d Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 23 Nov 2024 17:07:59 +0100 Subject: [PATCH] [clean] Internet Archive Scholar search API no longer exists Engine was added in #2733 but the API does no longer exists. Related: - https://github.com/searxng/searxng/issues/4038 Signed-off-by: Markus Heiser --- searx/engines/internet_archive_scholar.py | 71 ----------------------- searx/settings.yml | 5 -- 2 files changed, 76 deletions(-) delete mode 100644 searx/engines/internet_archive_scholar.py diff --git a/searx/engines/internet_archive_scholar.py b/searx/engines/internet_archive_scholar.py deleted file mode 100644 index d3956eb71..000000000 --- a/searx/engines/internet_archive_scholar.py +++ /dev/null @@ -1,71 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later -"""Internet Archive scholar(science) -""" - -from datetime import datetime -from urllib.parse import urlencode -from searx.utils import html_to_text - -about = { - "website": "https://scholar.archive.org/", - "wikidata_id": "Q115667709", - "official_api_documentation": "https://scholar.archive.org/api/redoc", - "use_official_api": True, - "require_api_key": False, - "results": "JSON", -} -categories = ['science', 'scientific publications'] -paging = True - -base_url = "https://scholar.archive.org" -results_per_page = 15 - - -def request(query, params): - args = { - "q": query, - "limit": results_per_page, - "offset": (params["pageno"] - 1) * results_per_page, - } - params["url"] = f"{base_url}/search?{urlencode(args)}" - params["headers"]["Accept"] = "application/json" - return params - - -def response(resp): - results = [] - - json = resp.json() - - for result in json["results"]: - publishedDate, content, doi = None, '', None - - if result['biblio'].get('release_date'): - publishedDate = datetime.strptime(result['biblio']['release_date'], "%Y-%m-%d") - - if len(result['abstracts']) > 0: - content = result['abstracts'][0].get('body') - elif len(result['_highlights']) > 0: - content = result['_highlights'][0] - - if len(result['releases']) > 0: - doi = result['releases'][0].get('doi') - - results.append( - { - 'template': 'paper.html', - 'url': result['fulltext']['access_url'], - 'title': result['biblio'].get('title') or result['biblio'].get('container_name'), - 'content': html_to_text(content), - 'publisher': result['biblio'].get('publisher'), - 'doi': doi, - 'journal': result['biblio'].get('container_name'), - 'authors': result['biblio'].get('contrib_names'), - 'tags': result['tags'], - 'publishedDate': publishedDate, - 'issns': result['biblio'].get('issns'), - 'pdf_url': result['fulltext'].get('access_url'), - } - ) - - return results diff --git a/searx/settings.yml b/searx/settings.yml index 5d16f6377..60d04bb0e 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -1622,11 +1622,6 @@ engines: api_site: 'askubuntu' categories: [it, q&a] - - name: internetarchivescholar - engine: internet_archive_scholar - shortcut: ias - timeout: 15.0 - - name: superuser engine: stackexchange shortcut: su