mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Merge branch 'searxng:master' into wikidata-fediverse
This commit is contained in:
commit
bd27c36de2
28 changed files with 243 additions and 89 deletions
93
searx/engines/astrophysics_data_system.py
Normal file
93
searx/engines/astrophysics_data_system.py
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
""".. sidebar:: info
|
||||
|
||||
The Astrophysics Data System (ADS) is a digital library portal for researchers in astronomy and physics,
|
||||
operated by the Smithsonian Astrophysical Observatory (SAO) under a NASA grant.
|
||||
The engine is adapted from the solr engine.
|
||||
|
||||
"""
|
||||
|
||||
# pylint: disable=global-statement
|
||||
|
||||
from datetime import datetime
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
from searx.exceptions import SearxEngineAPIException
|
||||
|
||||
about = {
|
||||
"website": 'https://ui.adsabs.harvard.edu/',
|
||||
"wikidata_id": 'Q752099',
|
||||
"official_api_documentation": 'https://ui.adsabs.harvard.edu/help/api/api-docs.html',
|
||||
"use_official_api": True,
|
||||
"require_api_key": True,
|
||||
"results": 'JSON',
|
||||
}
|
||||
|
||||
base_url = 'https://api.adsabs.harvard.edu/v1/search'
|
||||
result_base_url = 'https://ui.adsabs.harvard.edu/abs/'
|
||||
rows = 10
|
||||
sort = '' # sorting: asc or desc
|
||||
field_list = ['bibcode', 'author', 'title', 'abstract', 'doi', 'date'] # list of field names to display on the UI
|
||||
default_fields = '' # default field to query
|
||||
query_fields = '' # query fields
|
||||
paging = True
|
||||
api_key = 'unset'
|
||||
|
||||
|
||||
def init(_):
|
||||
if api_key == 'unset':
|
||||
raise SearxEngineAPIException('missing ADS API key')
|
||||
|
||||
|
||||
def request(query, params):
|
||||
query_params = {'q': query, 'rows': rows}
|
||||
if field_list:
|
||||
query_params['fl'] = ','.join(field_list)
|
||||
if query_fields:
|
||||
query_params['qf'] = ','.join(query_fields)
|
||||
if default_fields:
|
||||
query_params['df'] = default_fields
|
||||
if sort:
|
||||
query_params['sort'] = sort
|
||||
|
||||
query_params['start'] = rows * (params['pageno'] - 1)
|
||||
|
||||
params['headers']['Authorization'] = f'Bearer {api_key}'
|
||||
params['url'] = f"{base_url}/query?{urlencode(query_params)}"
|
||||
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
try:
|
||||
resp_json = loads(resp.text)
|
||||
except Exception as e:
|
||||
raise SearxEngineAPIException("failed to parse response") from e
|
||||
|
||||
if 'error' in resp_json:
|
||||
raise SearxEngineAPIException(resp_json['error']['msg'])
|
||||
|
||||
resp_json = resp_json["response"]
|
||||
result_len = resp_json["numFound"]
|
||||
results = []
|
||||
|
||||
for res in resp_json["docs"]:
|
||||
author = res.get("author")
|
||||
|
||||
if author:
|
||||
author = author[0] + ' et al.'
|
||||
|
||||
results.append(
|
||||
{
|
||||
'url': result_base_url + res.get("bibcode") + "/",
|
||||
'title': res.get("title")[0],
|
||||
'author': author,
|
||||
'content': res.get("abstract"),
|
||||
'doi': res.get("doi"),
|
||||
'publishedDate': datetime.fromisoformat(res.get("date")),
|
||||
}
|
||||
)
|
||||
|
||||
results.append({'number_of_results': result_len})
|
||||
|
||||
return results
|
||||
|
|
@ -380,6 +380,14 @@ engines:
|
|||
require_api_key: false
|
||||
results: JSON
|
||||
|
||||
# - name: astrophysics data system
|
||||
# engine: astrophysics_data_system
|
||||
# sort: asc
|
||||
# weight: 5
|
||||
# categories: [science]
|
||||
# api_key: your-new-key
|
||||
# shortcut: ads
|
||||
|
||||
- name: alpine linux packages
|
||||
engine: alpinelinux
|
||||
disabled: true
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -21,9 +21,10 @@ module.exports = function (grunt) {
|
|||
pkg: grunt.file.readJSON('package.json'),
|
||||
watch: {
|
||||
scripts: {
|
||||
files: ['gruntfile.js', 'src/**'],
|
||||
files: ['gruntfile.js', 'eslint.config.mjs', '.stylelintrc.json', 'src/**'],
|
||||
tasks: [
|
||||
'eslint',
|
||||
'stylelint',
|
||||
'copy',
|
||||
'uglify',
|
||||
'less',
|
||||
|
|
@ -49,6 +50,7 @@ module.exports = function (grunt) {
|
|||
stylelint: {
|
||||
options: {
|
||||
formatter: 'unix',
|
||||
fix: grunt.option('fix')
|
||||
},
|
||||
src: [
|
||||
'src/less/**/*.less',
|
||||
|
|
@ -298,7 +300,7 @@ module.exports = function (grunt) {
|
|||
grunt.loadNpmTasks('grunt-stylelint');
|
||||
grunt.loadNpmTasks('grunt-eslint');
|
||||
|
||||
grunt.registerTask('test', ['eslint']);
|
||||
grunt.registerTask('test', ['eslint', 'stylelint']);
|
||||
|
||||
grunt.registerTask('default', [
|
||||
'eslint',
|
||||
|
|
|
|||
|
|
@ -29,12 +29,13 @@
|
|||
"scripts": {
|
||||
"all": "npm install && grunt",
|
||||
"build": "grunt",
|
||||
"test": "grunt test",
|
||||
"clean": "rm -Rf node_modules",
|
||||
"eslint": "grunt eslint",
|
||||
"eslint-fix": "grunt eslint --fix",
|
||||
"watch": "grunt watch",
|
||||
"clean": "rm -Rf node_modules",
|
||||
"fix": "grunt test --fix",
|
||||
"stylelint": "grunt stylelint",
|
||||
"stylelint-fix": "grunt stylelint --fix"
|
||||
"stylelint-fix": "grunt stylelint --fix",
|
||||
"test": "grunt test",
|
||||
"watch": "grunt watch --fix"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
color: var(--color-autocomplete-font);
|
||||
max-height: 32rem;
|
||||
overflow-y: auto;
|
||||
z-index: 100;
|
||||
z-index: 5000;
|
||||
margin-top: 3.5rem;
|
||||
border-radius: 0.8rem;
|
||||
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@
|
|||
@results-image-row-height-phone: 10rem;
|
||||
@search-width: 44rem;
|
||||
// heigh of #search, see detail.less
|
||||
@search-height: 7.6rem;
|
||||
@search-height: 13rem;
|
||||
|
||||
/// Device Size
|
||||
/// @desktop > @tablet
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ article.result-images .detail {
|
|||
bottom: 0;
|
||||
background: var(--color-result-detail-background);
|
||||
border: 1px solid var(--color-result-detail-background);
|
||||
z-index: 10000;
|
||||
z-index: 1000;
|
||||
padding: 4rem 3rem 3rem 3rem;
|
||||
|
||||
a.result-images-source {
|
||||
|
|
@ -148,7 +148,7 @@ article.result-images .detail {
|
|||
height: 1.5rem;
|
||||
position: absolute;
|
||||
filter: opacity(40%);
|
||||
z-index: 2000002;
|
||||
z-index: 1200;
|
||||
|
||||
span {
|
||||
display: block;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ button.category_button {
|
|||
outline: none;
|
||||
color: var(--color-search-font);
|
||||
font-size: 1.1rem;
|
||||
z-index: 10000;
|
||||
z-index: 1000;
|
||||
|
||||
&:hover {
|
||||
color: var(--color-search-background-hover);
|
||||
|
|
@ -183,7 +183,7 @@ html.no-js #clear_search.hide_if_nojs {
|
|||
outline: none;
|
||||
color: var(--color-search-font);
|
||||
font-size: 1.1rem;
|
||||
z-index: 2;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
#q {
|
||||
|
|
@ -332,7 +332,7 @@ html.no-js #clear_search.hide_if_nojs {
|
|||
top: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 10000;
|
||||
z-index: 2000;
|
||||
|
||||
.search_box {
|
||||
border-bottom: 1px solid var(--color-search-border);
|
||||
|
|
|
|||
|
|
@ -543,7 +543,13 @@ article[data-vim-selected].category-social {
|
|||
margin-bottom: 0;
|
||||
.ltr-margin-left(@results-offset);
|
||||
display: grid;
|
||||
grid-template: "corrections sidebar" min-content "answers sidebar" min-content "urls sidebar" 1fr "pagination sidebar" min-content / @results-width @results-sidebar-width;
|
||||
grid-template:
|
||||
"corrections sidebar" min-content
|
||||
"answers sidebar" min-content
|
||||
"urls sidebar" 1fr
|
||||
"pagination sidebar" min-content
|
||||
/ @results-width @results-sidebar-width
|
||||
;
|
||||
gap: 0 @results-gap;
|
||||
}
|
||||
|
||||
|
|
@ -967,7 +973,14 @@ summary.title {
|
|||
margin: 0 auto;
|
||||
justify-content: center;
|
||||
display: grid;
|
||||
grid-template: "corrections" min-content "answers" min-content "sidebar" min-content "urls" 1fr "pagination" min-content min-content / @results-width;
|
||||
grid-template:
|
||||
"corrections" min-content
|
||||
"answers" min-content
|
||||
"sidebar" min-content
|
||||
"urls" 1fr
|
||||
"pagination" min-content
|
||||
/ @results-width
|
||||
;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1005,7 +1018,13 @@ summary.title {
|
|||
#main_results div#results.only_template_images {
|
||||
margin: 1rem @results-tablet-offset 0 @results-tablet-offset;
|
||||
display: grid;
|
||||
grid-template: "corrections" min-content "answers" min-content "sidebar" min-content "urls" 1fr "pagination" min-content / 100%;
|
||||
grid-template:
|
||||
"corrections" min-content
|
||||
"answers" min-content
|
||||
"sidebar" min-content
|
||||
"urls" 1fr
|
||||
"pagination" min-content
|
||||
/ 100%;
|
||||
gap: 0;
|
||||
|
||||
#sidebar {
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ div.selectable_url {
|
|||
left: 50%;
|
||||
margin: 0 auto;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 10000000;
|
||||
z-index: 5000;
|
||||
|
||||
h3 {
|
||||
margin-top: 0;
|
||||
|
|
@ -339,7 +339,7 @@ select {
|
|||
padding: 0.2rem !important;
|
||||
color: var(--color-search-font);
|
||||
font-size: 0.9rem;
|
||||
z-index: 2;
|
||||
z-index: 100;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
|
|
@ -413,7 +413,7 @@ input.checkbox-onoff[type="checkbox"] {
|
|||
border: 1px solid var(--color-btn-background);
|
||||
border-radius: 12px;
|
||||
box-shadow: var(--color-btn-background) 0 0 3px;
|
||||
z-index: 10000;
|
||||
z-index: 1200;
|
||||
top: -0.55em;
|
||||
left: -0.6em;
|
||||
}
|
||||
|
|
@ -573,7 +573,7 @@ input.checkbox-onoff.reversed-checkbox[type="checkbox"] {
|
|||
background: var(--color-toolkit-engine-tooltip-background);
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
z-index: 1000000;
|
||||
z-index: 5000;
|
||||
text-align: left;
|
||||
.rounded-corners;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -25,20 +25,20 @@
|
|||
# Yahya-Lando <yahya-lando@users.noreply.translate.codeberg.org>, 2025.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: searx\n"
|
||||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-01-06 16:16+0000\n"
|
||||
"PO-Revision-Date: 2025-01-06 15:52+0000\n"
|
||||
"Last-Translator: Yahya-Lando <yahya-"
|
||||
"lando@users.noreply.translate.codeberg.org>\n"
|
||||
"PO-Revision-Date: 2025-01-15 06:48+0000\n"
|
||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
||||
"Language-Team: Arabic <https://translate.codeberg.org/projects/searxng/"
|
||||
"searxng/ar/>\n"
|
||||
"Language: ar\n"
|
||||
"Language-Team: Arabic "
|
||||
"<https://translate.codeberg.org/projects/searxng/searxng/ar/>\n"
|
||||
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : "
|
||||
"n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
|
||||
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
|
||||
"X-Generator: Weblate 5.9.2\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
|
@ -1380,23 +1380,23 @@ msgstr "تغيير لغة واجهة البحث"
|
|||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:2
|
||||
msgid "URL formatting"
|
||||
msgstr ""
|
||||
msgstr "تنسيق العنوان"
|
||||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:8
|
||||
msgid "Pretty"
|
||||
msgstr ""
|
||||
msgstr "جميل"
|
||||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:13
|
||||
msgid "Full"
|
||||
msgstr ""
|
||||
msgstr "ممتلىء"
|
||||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:18
|
||||
msgid "Host"
|
||||
msgstr ""
|
||||
msgstr "مضيف"
|
||||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:23
|
||||
msgid "Change result URL formatting"
|
||||
msgstr ""
|
||||
msgstr "تغيير تنسيق العنوان للنتيجة"
|
||||
|
||||
#: searx/templates/simple/result_templates/code.html:13
|
||||
msgid "repo"
|
||||
|
|
@ -2004,4 +2004,3 @@ msgstr "إخفاء الفيديو"
|
|||
|
||||
#~ msgid "dummy"
|
||||
#~ msgstr ""
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -27,19 +27,19 @@
|
|||
# syobon <syobon@users.noreply.translate.codeberg.org>, 2025.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: searx\n"
|
||||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-01-06 16:16+0000\n"
|
||||
"PO-Revision-Date: 2025-01-06 15:53+0000\n"
|
||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>"
|
||||
"\n"
|
||||
"PO-Revision-Date: 2025-01-17 07:09+0000\n"
|
||||
"Last-Translator: tentsbet <tentsbet@users.noreply.translate.codeberg.org>\n"
|
||||
"Language-Team: Japanese <https://translate.codeberg.org/projects/searxng/"
|
||||
"searxng/ja/>\n"
|
||||
"Language: ja\n"
|
||||
"Language-Team: Japanese "
|
||||
"<https://translate.codeberg.org/projects/searxng/searxng/ja/>\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 5.9.2\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
|
@ -1348,23 +1348,23 @@ msgstr "表示する言語を変更"
|
|||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:2
|
||||
msgid "URL formatting"
|
||||
msgstr ""
|
||||
msgstr "URL 書式"
|
||||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:8
|
||||
msgid "Pretty"
|
||||
msgstr ""
|
||||
msgstr "相当"
|
||||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:13
|
||||
msgid "Full"
|
||||
msgstr ""
|
||||
msgstr "一杯"
|
||||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:18
|
||||
msgid "Host"
|
||||
msgstr ""
|
||||
msgstr "ホスト"
|
||||
|
||||
#: searx/templates/simple/preferences/urlformatting.html:23
|
||||
msgid "Change result URL formatting"
|
||||
msgstr ""
|
||||
msgstr "検索結果のURL書式を変更"
|
||||
|
||||
#: searx/templates/simple/result_templates/code.html:13
|
||||
msgid "repo"
|
||||
|
|
@ -1947,4 +1947,3 @@ msgstr "動画を隠す"
|
|||
|
||||
#~ msgid "dummy"
|
||||
#~ msgstr ""
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -14,20 +14,21 @@
|
|||
# Mooo <mooo@users.noreply.translate.codeberg.org>, 2025.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: searx\n"
|
||||
"Project-Id-Version: searx\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-01-06 16:16+0000\n"
|
||||
"PO-Revision-Date: 2025-01-06 15:53+0000\n"
|
||||
"Last-Translator: Mooo <mooo@users.noreply.translate.codeberg.org>\n"
|
||||
"PO-Revision-Date: 2025-01-15 06:48+0000\n"
|
||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
||||
"Language-Team: Lithuanian <https://translate.codeberg.org/projects/searxng/"
|
||||
"searxng/lt/>\n"
|
||||
"Language: lt\n"
|
||||
"Language-Team: Lithuanian "
|
||||
"<https://translate.codeberg.org/projects/searxng/searxng/lt/>\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100"
|
||||
" < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < "
|
||||
"11) ? 1 : n % 1 != 0 ? 2: 3);\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < "
|
||||
"11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 :"
|
||||
" n % 1 != 0 ? 2: 3);\n"
|
||||
"X-Generator: Weblate 5.9.2\n"
|
||||
"Generated-By: Babel 2.16.0\n"
|
||||
|
||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||
|
|
@ -168,7 +169,7 @@ msgstr "tamsi"
|
|||
#. STYLE_NAMES['BLACK']
|
||||
#: searx/searxng.msg
|
||||
msgid "black"
|
||||
msgstr ""
|
||||
msgstr "juoda"
|
||||
|
||||
#. BRAND_CUSTOM_LINKS['UPTIME']
|
||||
#: searx/searxng.msg
|
||||
|
|
@ -1981,4 +1982,3 @@ msgstr "slėpti vaizdo įrašą"
|
|||
|
||||
#~ msgid "dummy"
|
||||
#~ msgstr ""
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -14,7 +14,7 @@ msgstr ""
|
|||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-01-06 16:16+0000\n"
|
||||
"PO-Revision-Date: 2025-01-10 07:09+0000\n"
|
||||
"PO-Revision-Date: 2025-01-15 06:48+0000\n"
|
||||
"Last-Translator: hirushaadi <hirushaadi@users.noreply.translate.codeberg.org>"
|
||||
"\n"
|
||||
"Language-Team: Sinhala <https://translate.codeberg.org/projects/searxng/"
|
||||
|
|
@ -313,7 +313,7 @@ msgstr ""
|
|||
#. SOCIAL_MEDIA_TERMS['COMMUNITY']
|
||||
#: searx/engines/lemmy.py:131 searx/engines/lemmy.py:165 searx/searxng.msg
|
||||
msgid "community"
|
||||
msgstr ""
|
||||
msgstr "ප්රජාව or පිරිස"
|
||||
|
||||
#. SOCIAL_MEDIA_TERMS['POINTS']
|
||||
#: searx/engines/hackernews.py:82 searx/searxng.msg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue