index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
23,825 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/flickr.py | 50,51 | 1,96 | response | 51,96 | 51,96 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Flickr (Images)
More info on api-key : https://www.flickr.com/services/apps/create/
"""
from json import loads
from urllib.parse import urlencode
# about
about = {
"website": 'https://www.flickr.com',
"wikidata_id": 'Q103204',
"official_api_documentation... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Flickr (Images)
More info on api-key : https://www.flickr.com/services/apps/create/
"""
from json import loads
from urllib.parse import urlencode
# about
about = {
"website": 'https://www.flickr.com',
"wikidata_id": 'Q103204',
"official_api_documentation... | results = []
search_results = loads(resp.text)
# return empty array if there are no results
if 'photos' not in search_results:
return []
if 'photo' not in search_results['photos']:
return []
photos = search_results['photos']['photo']
# parse results
for photo in phot... | results = []
search_results = loads(resp.text)
# return empty array if there are no results
if 'photos' not in search_results:
return []
if 'photo' not in search_results['photos']:
return []
photos = search_results['photos']['photo']
# parse results
for photo in phot... | 112 | 506 | 395 | 901 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Flickr (Images)
More info on api-key : https://www.flickr.com/services/apps/create/
"""
from json import loads
from urllib.parse import urlencode
# about
about = {
"website": 'https://www.flickr.com',
"wikidata_id": 'Q103204',
"official_api_documentation... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Flickr (Images)
More info on api-key : https://www.flickr.com/services/apps/create/
"""
from json import loads
from urllib.parse import urlencode
# about
about = {
"website": 'https://www.flickr.com',
"wikidata_id": 'Q103204',
"official_api_documentation... | |
23,826 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/freesound.py | 44,45 | 1,66 | response | 45,66 | 45,66 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Freesound (Sound)
"""
from json import loads
from urllib.parse import urlencode
from datetime import datetime
disabled = True
api_key = ""
# about
about = {
"website": "https://freesound.org",
"wikidata_id": "Q835703",
"official_api_documentation": "https:... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Freesound (Sound)
"""
from json import loads
from urllib.parse import urlencode
from datetime import datetime
disabled = True
api_key = ""
# about
about = {
"website": "https://freesound.org",
"wikidata_id": "Q835703",
"official_api_documentation": "https:... | results = []
search_res = loads(resp.text)
# parse results
for result in search_res.get("results", []):
title = result["name"]
content = result["description"][:128]
publishedDate = datetime.fromisoformat(result["created"])
uri = result["download"]
# append result... | results = []
search_res = loads(resp.text)
# parse results
for result in search_res.get("results", []):
title = result["name"]
content = result["description"][:128]
publishedDate = datetime.fromisoformat(result["created"])
uri = result["download"]
# append result... | 45 | 334 | 171 | 505 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Freesound (Sound)
"""
from json import loads
from urllib.parse import urlencode
from datetime import datetime
disabled = True
api_key = ""
# about
about = {
"website": "https://freesound.org",
"wikidata_id": "Q835703",
"official_api_documentation": "https:... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Freesound (Sound)
"""
from json import loads
from urllib.parse import urlencode
from datetime import datetime
disabled = True
api_key = ""
# about
about = {
"website": "https://freesound.org",
"wikidata_id": "Q835703",
"official_api_documentation": "https:... | |
23,827 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/frinkiac.py | 33,34 | 1,52 | response | 34,52 | 34,52 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Frinkiac (Images)
"""
from json import loads
from urllib.parse import urlencode
# about
about = {
"website": 'https://frinkiac.com',
"wikidata_id": 'Q24882614',
"official_api_documentation": {'url': None, 'comment': 'see https://github.com/MitchellAW/Compu... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Frinkiac (Images)
"""
from json import loads
from urllib.parse import urlencode
# about
about = {
"website": 'https://frinkiac.com',
"wikidata_id": 'Q24882614',
"official_api_documentation": {'url': None, 'comment': 'see https://github.com/MitchellAW/Compu... | results = []
response_data = loads(resp.text)
for result in response_data:
episode = result['Episode']
timestamp = result['Timestamp']
results.append(
{
'template': 'images.html',
'url': RESULT_URL.format(base=BASE, query=urlencode({'p': '... | results = []
response_data = loads(resp.text)
for result in response_data:
episode = result['Episode']
timestamp = result['Timestamp']
results.append(
{
'template': 'images.html',
'url': RESULT_URL.format(base=BASE, query=urlencode({'p': '... | 44 | 315 | 199 | 514 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Frinkiac (Images)
"""
from json import loads
from urllib.parse import urlencode
# about
about = {
"website": 'https://frinkiac.com',
"wikidata_id": 'Q24882614',
"official_api_documentation": {'url': None, 'comment': 'see https://github.com/MitchellAW/Compu... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Frinkiac (Images)
"""
from json import loads
from urllib.parse import urlencode
# about
about = {
"website": 'https://frinkiac.com',
"wikidata_id": 'Q24882614',
"official_api_documentation": {'url': None, 'comment': 'see https://github.com/MitchellAW/Compu... | |
23,828 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/fyyd.py | 32,33 | 1,50 | response | 33,50 | 33,50 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Fyyd (podcasts)
"""
from datetime import datetime
from urllib.parse import urlencode
about = {
'website': 'https://fyyd.de',
'official_api_documentation': 'https://github.com/eazyliving/fyyd-api',
'use_official_api': True,
'require_api_key': False,
'... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Fyyd (podcasts)
"""
from datetime import datetime
from urllib.parse import urlencode
about = {
'website': 'https://fyyd.de',
'official_api_documentation': 'https://github.com/eazyliving/fyyd-api',
'use_official_api': True,
'require_api_key': False,
'... | results = []
json_results = resp.json()['data']
for result in json_results:
results.append(
{
'url': result['htmlURL'],
'title': result['title'],
'content': result['description'],
'thumbnail': result['smallImageURL'],
... | results = []
json_results = resp.json()['data']
for result in json_results:
results.append(
{
'url': result['htmlURL'],
'title': result['title'],
'content': result['description'],
'thumbnail': result['smallImageURL'],
... | 34 | 262 | 169 | 431 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Fyyd (podcasts)
"""
from datetime import datetime
from urllib.parse import urlencode
about = {
'website': 'https://fyyd.de',
'official_api_documentation': 'https://github.com/eazyliving/fyyd-api',
'use_official_api': True,
'require_api_key': False,
'... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Fyyd (podcasts)
"""
from datetime import datetime
from urllib.parse import urlencode
about = {
'website': 'https://fyyd.de',
'official_api_documentation': 'https://github.com/eazyliving/fyyd-api',
'use_official_api': True,
'require_api_key': False,
'... | |
23,829 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/genius.py | 40,41 | 1,103 | parse_lyric | 41,66 | 41,66 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=invalid-name
"""Genius
"""
from urllib.parse import urlencode
from datetime import datetime
# about
about = {
"website": 'https://genius.com/',
"wikidata_id": 'Q3419343',
"official_api_documentation": 'https://docs.genius.com/',
"use_offi... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=invalid-name
"""Genius
"""
from urllib.parse import urlencode
from datetime import datetime
# about
about = {
"website": 'https://genius.com/',
"wikidata_id": 'Q3419343',
"official_api_documentation": 'https://docs.genius.com/',
"use_offi... | content = ''
highlights = hit['highlights']
if highlights:
content = hit['highlights'][0]['value']
else:
content = hit['result'].get('title_with_featured', '')
timestamp = hit['result']['lyrics_updated_at']
result = {
'url': hit['result']['url'],
'title': hit['re... | content = ''
highlights = hit['highlights']
if highlights:
content = hit['highlights'][0]['value']
else:
content = hit['result'].get('title_with_featured', '')
timestamp = hit['result']['lyrics_updated_at']
result = {
'url': hit['result']['url'],
'title': hit['re... | 82 | 668 | 286 | 954 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=invalid-name
"""Genius
"""
from urllib.parse import urlencode
from datetime import datetime
# about
about = {
"website": 'https://genius.com/',
"wikidata_id": 'Q3419343',
"official_api_documentation": 'https://docs.genius.com/',
"use_offi... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=invalid-name
"""Genius
"""
from urllib.parse import urlencode
from datetime import datetime
# about
about = {
"website": 'https://genius.com/',
"wikidata_id": 'Q3419343',
"official_api_documentation": 'https://docs.genius.com/',
"use_offi... | |
23,830 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/gentoo.py | 84,85 | 1,126 | request | 85,107 | 85,107 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Gentoo Wiki
"""
from urllib.parse import urlencode, urljoin
from lxml import html
from searx.utils import extract_text
# about
about = {
"website": 'https://wiki.gentoo.org/',
"wikidata_id": 'Q1050637',
"official_api_documentation": 'https://wiki.gentoo.or... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Gentoo Wiki
"""
from urllib.parse import urlencode, urljoin
from lxml import html
from searx.utils import extract_text
# about
about = {
"website": 'https://wiki.gentoo.org/',
"wikidata_id": 'Q1050637',
"official_api_documentation": 'https://wiki.gentoo.or... | # translate the locale (e.g. 'en-US') to language code ('en')
language = locale_to_lang_code(params['language'])
# if our language is hosted on the main site, we need to add its name
# to the query in order to narrow the results to that language
if language in main_langs:
query += ' (' + ma... | # translate the locale (e.g. 'en-US') to language code ('en')
language = locale_to_lang_code(params['language'])
# if our language is hosted on the main site, we need to add its name
# to the query in order to narrow the results to that language
if language in main_langs:
query += ' (' + ma... | 99 | 1,036 | 246 | 1,282 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Gentoo Wiki
"""
from urllib.parse import urlencode, urljoin
from lxml import html
from searx.utils import extract_text
# about
about = {
"website": 'https://wiki.gentoo.org/',
"wikidata_id": 'Q1050637',
"official_api_documentation": 'https://wiki.gentoo.or... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Gentoo Wiki
"""
from urllib.parse import urlencode, urljoin
from lxml import html
from searx.utils import extract_text
# about
about = {
"website": 'https://wiki.gentoo.org/',
"wikidata_id": 'Q1050637',
"official_api_documentation": 'https://wiki.gentoo.or... | |
23,831 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/github.py | 35,36 | 1,68 | response | 36,68 | 36,68 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Github (IT)
"""
from urllib.parse import urlencode
from dateutil import parser
# about
about = {
"website": 'https://github.com/',
"wikidata_id": 'Q364',
"official_api_documentation": 'https://developer.github.com/v3/',
"use_official_api": True,
"re... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Github (IT)
"""
from urllib.parse import urlencode
from dateutil import parser
# about
about = {
"website": 'https://github.com/',
"wikidata_id": 'Q364',
"official_api_documentation": 'https://developer.github.com/v3/',
"use_official_api": True,
"re... | results = []
for item in resp.json().get('items', []):
content = [item.get(i) for i in ['language', 'description'] if item.get(i)]
# license can be None
lic = item.get('license') or {}
lic_url = None
if lic.get('spdx_id'):
lic_url = f"https://spdx.org/licens... | results = []
for item in resp.json().get('items', []):
content = [item.get(i) for i in ['language', 'description'] if item.get(i)]
# license can be None
lic = item.get('license') or {}
lic_url = None
if lic.get('spdx_id'):
lic_url = f"https://spdx.org/licens... | 80 | 289 | 401 | 690 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Github (IT)
"""
from urllib.parse import urlencode
from dateutil import parser
# about
about = {
"website": 'https://github.com/',
"wikidata_id": 'Q364',
"official_api_documentation": 'https://developer.github.com/v3/',
"use_official_api": True,
"re... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Github (IT)
"""
from urllib.parse import urlencode
from dateutil import parser
# about
about = {
"website": 'https://github.com/',
"wikidata_id": 'Q364',
"official_api_documentation": 'https://developer.github.com/v3/',
"use_official_api": True,
"re... | |
23,832 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/goodreads.py | 31,32 | 1,58 | request | 32,41 | 32,41 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Goodreads (books)
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
'website': 'https://www.goodreads.com',
'wikidata_id': 'Q2359213',
'official_api_documentation': None,... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Goodreads (books)
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
'website': 'https://www.goodreads.com',
'wikidata_id': 'Q2359213',
'official_api_documentation': None,... | args = {
'q': query,
'page': params['pageno'],
}
params['url'] = f"{base_url}/search?{urlencode(args)}"
return params
| args = {
'q': query,
'page': params['pageno'],
}
params['url'] = f"{base_url}/search?{urlencode(args)}"
return params
| 13 | 509 | 65 | 574 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Goodreads (books)
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
'website': 'https://www.goodreads.com',
'wikidata_id': 'Q2359213',
'official_api_documentation': None,... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Goodreads (books)
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
'website': 'https://www.goodreads.com',
'wikidata_id': 'Q2359213',
'official_api_documentation': None,... | |
23,833 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/google_play.py | 54,55 | 1,116 | response_movies | 55,81 | 55,81 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Google Play Apps & Google Play Movies
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import (
eval_xpath,
extract_url,
extract_text,
eval_xpath_list,
eval_xpath_getindex,
)
about = {
"website": "https://play.google.... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Google Play Apps & Google Play Movies
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import (
eval_xpath,
extract_url,
extract_text,
eval_xpath_list,
eval_xpath_getindex,
)
about = {
"website": "https://play.google.... |
results = []
dom = html.fromstring(resp.text)
for section in eval_xpath(dom, '//c-wiz/section/header/..'):
sec_name = extract_text(eval_xpath(section, './header'))
for item in eval_xpath(section, './/a'):
url = base_url + item.get('href')
div_1, div_2 = eval_xpath(i... |
results = []
dom = html.fromstring(resp.text)
for section in eval_xpath(dom, '//c-wiz/section/header/..'):
sec_name = extract_text(eval_xpath(section, './header'))
for item in eval_xpath(section, './/a'):
url = base_url + item.get('href')
div_1, div_2 = eval_xpath(i... | 63 | 1,048 | 303 | 1,351 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Google Play Apps & Google Play Movies
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import (
eval_xpath,
extract_url,
extract_text,
eval_xpath_list,
eval_xpath_getindex,
)
about = {
"website": "https://play.google.... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Google Play Apps & Google Play Movies
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import (
eval_xpath,
extract_url,
extract_text,
eval_xpath_list,
eval_xpath_getindex,
)
about = {
"website": "https://play.google.... | |
23,834 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/hackernews.py | 31,32 | 1,91 | request | 32,67 | 32,67 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Hackernews
"""
from datetime import datetime
from urllib.parse import urlencode
from dateutil.relativedelta import relativedelta
from flask_babel import gettext
# Engine metadata
about = {
"website": "https://news.ycombinator.com/",
"wikidata_id": "Q686797",
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Hackernews
"""
from datetime import datetime
from urllib.parse import urlencode
from dateutil.relativedelta import relativedelta
from flask_babel import gettext
# Engine metadata
about = {
"website": "https://news.ycombinator.com/",
"wikidata_id": "Q686797",
... | search_type = 'search'
if not query:
# if search query is empty show results from HN's front page
search_type = 'search_by_date'
query_params = {
"tags": "front_page",
"page": (params["pageno"] - 1),
}
else:
query_params = {
"query"... | search_type = 'search'
if not query:
# if search query is empty show results from HN's front page
search_type = 'search_by_date'
query_params = {
"tags": "front_page",
"page": (params["pageno"] - 1),
}
else:
query_params = {
"query"... | 85 | 525 | 431 | 956 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Hackernews
"""
from datetime import datetime
from urllib.parse import urlencode
from dateutil.relativedelta import relativedelta
from flask_babel import gettext
# Engine metadata
about = {
"website": "https://news.ycombinator.com/",
"wikidata_id": "Q686797",
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Hackernews
"""
from datetime import datetime
from urllib.parse import urlencode
from dateutil.relativedelta import relativedelta
from flask_babel import gettext
# Engine metadata
about = {
"website": "https://news.ycombinator.com/",
"wikidata_id": "Q686797",
... | |
23,835 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/hex.py | 26,27 | 1,57 | request | 27,32 | 27,32 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""hex.pm"""
from urllib.parse import urlencode
from dateutil import parser
about = {
# pylint: disable=line-too-long
"website": "https://hex.pm/",
"wikidata_id": None,
"official_api_documentation": "https://github.com/hexpm/hexpm/blob/main/lib/hexpm_web/c... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""hex.pm"""
from urllib.parse import urlencode
from dateutil import parser
about = {
# pylint: disable=line-too-long
"website": "https://hex.pm/",
"wikidata_id": None,
"official_api_documentation": "https://github.com/hexpm/hexpm/blob/main/lib/hexpm_web/c... | args = urlencode({"page": params["pageno"], "search": query})
params["url"] = f"{search_url}?{args}"
return params
| args = urlencode({"page": params["pageno"], "search": query})
params["url"] = f"{search_url}?{args}"
return params
| 11 | 465 | 50 | 515 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""hex.pm"""
from urllib.parse import urlencode
from dateutil import parser
about = {
# pylint: disable=line-too-long
"website": "https://hex.pm/",
"wikidata_id": None,
"official_api_documentation": "https://github.com/hexpm/hexpm/blob/main/lib/hexpm_web/c... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""hex.pm"""
from urllib.parse import urlencode
from dateutil import parser
about = {
# pylint: disable=line-too-long
"website": "https://hex.pm/",
"wikidata_id": None,
"official_api_documentation": "https://github.com/hexpm/hexpm/blob/main/lib/hexpm_web/c... | |
23,836 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/imgur.py | 41,42 | 1,66 | response | 42,66 | 42,66 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Imgur (images)
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
"website": 'https://imgur.com/',
"wikidata_id": 'Q355022',
"official_api_documentation": 'https://api.imgu... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Imgur (images)
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
"website": 'https://imgur.com/',
"wikidata_id": 'Q355022',
"official_api_documentation": 'https://api.imgu... | results = []
dom = html.fromstring(resp.text)
for result in eval_xpath_list(dom, results_xpath):
thumbnail_src = extract_text(eval_xpath(result, thumbnail_xpath))
img_src = thumbnail_src.replace("b.", ".")
# that's a bug at imgur's side:
# sometimes there's just no preview... | results = []
dom = html.fromstring(resp.text)
for result in eval_xpath_list(dom, results_xpath):
thumbnail_src = extract_text(eval_xpath(result, thumbnail_xpath))
img_src = thumbnail_src.replace("b.", ".")
# that's a bug at imgur's side:
# sometimes there's just no preview... | 63 | 395 | 256 | 651 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Imgur (images)
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
"website": 'https://imgur.com/',
"wikidata_id": 'Q355022',
"official_api_documentation": 'https://api.imgu... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Imgur (images)
"""
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
"website": 'https://imgur.com/',
"wikidata_id": 'Q355022',
"official_api_documentation": 'https://api.imgu... | |
23,837 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/ina.py | 47,48 | 1,76 | response | 48,76 | 48,76 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
INA (Videos)
"""
from html import unescape
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list, eval_xpath_getindex
# about
about = {
"website": 'https://www.ina.fr/',
"wikidata_id": 'Q1665... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
INA (Videos)
"""
from html import unescape
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list, eval_xpath_getindex
# about
about = {
"website": 'https://www.ina.fr/',
"wikidata_id": 'Q1665... | results = []
# we get html in a JSON container...
dom = html.fromstring(resp.text)
# parse results
for result in eval_xpath_list(dom, results_xpath):
url_relative = eval_xpath_getindex(result, url_xpath, 0)
url = base_url + url_relative
title = unescape(extract_text(eval_xp... | results = []
# we get html in a JSON container...
dom = html.fromstring(resp.text)
# parse results
for result in eval_xpath_list(dom, results_xpath):
url_relative = eval_xpath_getindex(result, url_xpath, 0)
url = base_url + url_relative
title = unescape(extract_text(eval_xp... | 71 | 481 | 282 | 763 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
INA (Videos)
"""
from html import unescape
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list, eval_xpath_getindex
# about
about = {
"website": 'https://www.ina.fr/',
"wikidata_id": 'Q1665... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
INA (Videos)
"""
from html import unescape
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list, eval_xpath_getindex
# about
about = {
"website": 'https://www.ina.fr/',
"wikidata_id": 'Q1665... | |
23,838 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/internet_archive_scholar.py | 24,25 | 1,72 | request | 25,35 | 25,35 | # 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... | # 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... | 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
| 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
| 22 | 610 | 103 | 713 | # 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... | # 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... | |
23,839 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/invidious.py | 56,57 | 1,104 | response | 57,104 | 57,104 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Invidious (Videos)
"""
import time
import random
from urllib.parse import quote_plus, urlparse
from dateutil import parser
# about
about = {
"website": 'https://api.invidious.io/',
"wikidata_id": 'Q79343316',
"official_api_documentation": 'https://github.com... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Invidious (Videos)
"""
import time
import random
from urllib.parse import quote_plus, urlparse
from dateutil import parser
# about
about = {
"website": 'https://api.invidious.io/',
"wikidata_id": 'Q79343316',
"official_api_documentation": 'https://github.com... | results = []
search_results = resp.json()
base_invidious_url = resp.search_params['base_url'] + "/watch?v="
for result in search_results:
rtype = result.get("type", None)
if rtype == "video":
videoid = result.get("videoId", None)
if not videoid:
... | results = []
search_results = resp.json()
base_invidious_url = resp.search_params['base_url'] + "/watch?v="
for result in search_results:
rtype = result.get("type", None)
if rtype == "video":
videoid = result.get("videoId", None)
if not videoid:
... | 143 | 547 | 523 | 1,070 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Invidious (Videos)
"""
import time
import random
from urllib.parse import quote_plus, urlparse
from dateutil import parser
# about
about = {
"website": 'https://api.invidious.io/',
"wikidata_id": 'Q79343316',
"official_api_documentation": 'https://github.com... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Invidious (Videos)
"""
import time
import random
from urllib.parse import quote_plus, urlparse
from dateutil import parser
# about
about = {
"website": 'https://api.invidious.io/',
"wikidata_id": 'Q79343316',
"official_api_documentation": 'https://github.com... | |
23,840 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/json_engine.py | 116,117 | 1,163 | identity | 117,120 | 117,120 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""The JSON engine is a *generic* engine with which it is possible to configure
engines in the settings.
.. todo::
- The JSON engine needs documentation!!
- The parameters of the JSON engine should be adapted to those of the XPath
engine.
"""
from collections... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""The JSON engine is a *generic* engine with which it is possible to configure
engines in the settings.
.. todo::
- The JSON engine needs documentation!!
- The parameters of the JSON engine should be adapted to those of the XPath
engine.
"""
from collections... | return arg
| return arg
| 2 | 1,284 | 9 | 1,293 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""The JSON engine is a *generic* engine with which it is possible to configure
engines in the settings.
.. todo::
- The JSON engine needs documentation!!
- The parameters of the JSON engine should be adapted to those of the XPath
engine.
"""
from collections... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""The JSON engine is a *generic* engine with which it is possible to configure
engines in the settings.
.. todo::
- The JSON engine needs documentation!!
- The parameters of the JSON engine should be adapted to those of the XPath
engine.
"""
from collections... | |
23,841 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/kickass.py | 34,35 | 1,63 | request | 35,41 | 35,41 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Kickass Torrent (Videos, Music, Files)"""
import random
from operator import itemgetter
from urllib.parse import quote
from lxml import html
from searx.utils import (
eval_xpath,
eval_xpath_getindex,
eval_xpath_list,
extract_text,
get_torrent_size,
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Kickass Torrent (Videos, Music, Files)"""
import random
from operator import itemgetter
from urllib.parse import quote
from lxml import html
from searx.utils import (
eval_xpath,
eval_xpath_getindex,
eval_xpath_list,
extract_text,
get_torrent_size,
... | params['base_url'] = random.choice(base_url) if isinstance(base_url, list) else base_url
params['url'] = params['base_url'] + f'/usearch/{quote(query)}/{params["pageno"]}/'
return params
| params['base_url'] = random.choice(base_url) if isinstance(base_url, list) else base_url
params['url'] = params['base_url'] + f'/usearch/{quote(query)}/{params["pageno"]}/'
return params
| 15 | 673 | 76 | 749 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Kickass Torrent (Videos, Music, Files)"""
import random
from operator import itemgetter
from urllib.parse import quote
from lxml import html
from searx.utils import (
eval_xpath,
eval_xpath_getindex,
eval_xpath_list,
extract_text,
get_torrent_size,
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Kickass Torrent (Videos, Music, Files)"""
import random
from operator import itemgetter
from urllib.parse import quote
from lxml import html
from searx.utils import (
eval_xpath,
eval_xpath_getindex,
eval_xpath_list,
extract_text,
get_torrent_size,
... | |
23,842 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/lemmy.py | 68,69 | 1,197 | request | 69,79 | 69,79 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""This engine uses the Lemmy API (https://lemmy.ml/api/v3/search), which is
documented at `lemmy-js-client`_ / `Interface Search`_. Since Lemmy is
federated, results are from many different, independent lemmy instances, and not
only the official one.
.. _lemmy-js-client: ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""This engine uses the Lemmy API (https://lemmy.ml/api/v3/search), which is
documented at `lemmy-js-client`_ / `Interface Search`_. Since Lemmy is
federated, results are from many different, independent lemmy instances, and not
only the official one.
.. _lemmy-js-client: ... | args = {
'q': query,
'page': params['pageno'],
'type_': lemmy_type,
}
params['url'] = f"{base_url}api/v3/search?{urlencode(args)}"
return params
| args = {
'q': query,
'page': params['pageno'],
'type_': lemmy_type,
}
params['url'] = f"{base_url}api/v3/search?{urlencode(args)}"
return params
| 15 | 1,718 | 83 | 1,801 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""This engine uses the Lemmy API (https://lemmy.ml/api/v3/search), which is
documented at `lemmy-js-client`_ / `Interface Search`_. Since Lemmy is
federated, results are from many different, independent lemmy instances, and not
only the official one.
.. _lemmy-js-client: ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""This engine uses the Lemmy API (https://lemmy.ml/api/v3/search), which is
documented at `lemmy-js-client`_ / `Interface Search`_. Since Lemmy is
federated, results are from many different, independent lemmy instances, and not
only the official one.
.. _lemmy-js-client: ... | |
23,843 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/lib_rs.py | 35,36 | 1,56 | response | 36,56 | 36,56 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""lib.rs (packages)"""
from urllib.parse import quote_plus
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
about = {
'website': 'https://lib.rs',
'wikidata_id': 'Q113486010',
'use_official_api': False,
'require_api_k... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""lib.rs (packages)"""
from urllib.parse import quote_plus
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
about = {
'website': 'https://lib.rs',
'wikidata_id': 'Q113486010',
'use_official_api': False,
'require_api_k... | results = []
doc = html.fromstring(resp.text)
for result in eval_xpath_list(doc, results_xpath):
package_name = extract_text(eval_xpath(result, title_xpath))
results.append(
{
'template': 'packages.html',
'title': package_name,
'u... | results = []
doc = html.fromstring(resp.text)
for result in eval_xpath_list(doc, results_xpath):
package_name = extract_text(eval_xpath(result, title_xpath))
results.append(
{
'template': 'packages.html',
'title': package_name,
'u... | 47 | 380 | 249 | 629 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""lib.rs (packages)"""
from urllib.parse import quote_plus
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
about = {
'website': 'https://lib.rs',
'wikidata_id': 'Q113486010',
'use_official_api': False,
'require_api_k... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""lib.rs (packages)"""
from urllib.parse import quote_plus
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
about = {
'website': 'https://lib.rs',
'wikidata_id': 'Q113486010',
'use_official_api': False,
'require_api_k... | |
23,844 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/libretranslate.py | 23,24 | 1,47 | request | 24,38 | 24,38 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""LibreTranslate (Free and Open Source Machine Translation API)"""
import random
from json import dumps
about = {
"website": 'https://libretranslate.com',
"wikidata_id": None,
"official_api_documentation": 'https://libretranslate.com/docs/',
"use_official_... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""LibreTranslate (Free and Open Source Machine Translation API)"""
import random
from json import dumps
about = {
"website": 'https://libretranslate.com',
"wikidata_id": None,
"official_api_documentation": 'https://libretranslate.com/docs/',
"use_official_... | request_url = random.choice(base_url) if isinstance(base_url, list) else base_url
params['url'] = f"{request_url}/translate"
args = {'source': params['from_lang'][1], 'target': params['to_lang'][1], 'q': params['query']}
if api_key:
args['api_key'] = api_key
params['data'] = dumps(args)
... | request_url = random.choice(base_url) if isinstance(base_url, list) else base_url
params['url'] = f"{request_url}/translate"
args = {'source': params['from_lang'][1], 'target': params['to_lang'][1], 'q': params['query']}
if api_key:
args['api_key'] = api_key
params['data'] = dumps(args)
... | 36 | 258 | 161 | 419 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""LibreTranslate (Free and Open Source Machine Translation API)"""
import random
from json import dumps
about = {
"website": 'https://libretranslate.com',
"wikidata_id": None,
"official_api_documentation": 'https://libretranslate.com/docs/',
"use_official_... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""LibreTranslate (Free and Open Source Machine Translation API)"""
import random
from json import dumps
about = {
"website": 'https://libretranslate.com',
"wikidata_id": None,
"official_api_documentation": 'https://libretranslate.com/docs/',
"use_official_... | |
23,845 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/lingva.py | 29,30 | 1,66 | response | 30,66 | 30,66 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Lingva (alternative Google Translate frontend)"""
from json import loads
about = {
"website": 'https://lingva.ml',
"wikidata_id": None,
"official_api_documentation": 'https://github.com/thedaviddelta/lingva-translate#public-apis',
"use_official_api": Tru... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Lingva (alternative Google Translate frontend)"""
from json import loads
about = {
"website": 'https://lingva.ml',
"wikidata_id": None,
"official_api_documentation": 'https://github.com/thedaviddelta/lingva-translate#public-apis',
"use_official_api": Tru... | results = []
result = loads(resp.text)
info = result["info"]
from_to_prefix = "%s-%s " % (resp.search_params['from_lang'][1], resp.search_params['to_lang'][1])
if "typo" in info:
results.append({"suggestion": from_to_prefix + info["typo"]})
if 'definitions' in info: # pylint: disable... | results = []
result = loads(resp.text)
info = result["info"]
from_to_prefix = "%s-%s " % (resp.search_params['from_lang'][1], resp.search_params['to_lang'][1])
if "typo" in info:
results.append({"suggestion": from_to_prefix + info["typo"]})
if 'definitions' in info: # pylint: disable... | 89 | 288 | 376 | 664 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Lingva (alternative Google Translate frontend)"""
from json import loads
about = {
"website": 'https://lingva.ml',
"wikidata_id": None,
"official_api_documentation": 'https://github.com/thedaviddelta/lingva-translate#public-apis',
"use_official_api": Tru... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Lingva (alternative Google Translate frontend)"""
from json import loads
about = {
"website": 'https://lingva.ml',
"wikidata_id": None,
"official_api_documentation": 'https://github.com/thedaviddelta/lingva-translate#public-apis',
"use_official_api": Tru... | |
23,846 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/livespace.py | 41,42 | 1,101 | response | 42,101 | 42,101 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""LiveSpace (Videos)
.. hint::
This engine only search for **live streams**!
"""
from urllib.parse import urlencode
from datetime import datetime
from babel import dates
about = {
"website": 'https://live.space',
"wikidata_id": None,
"official_api_docume... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""LiveSpace (Videos)
.. hint::
This engine only search for **live streams**!
"""
from urllib.parse import urlencode
from datetime import datetime
from babel import dates
about = {
"website": 'https://live.space',
"wikidata_id": None,
"official_api_docume... |
results = []
json = resp.json()
now = datetime.now()
# for live videos
for result in json.get('result', []):
title = result.get("title")
thumbnailUrl = result.get("thumbnailUrl")
category = result.get("category/name")
username = result.get("user", {}).get("userNam... |
results = []
json = resp.json()
now = datetime.now()
# for live videos
for result in json.get('result', []):
title = result.get("title")
thumbnailUrl = result.get("thumbnailUrl")
category = result.get("category/name")
username = result.get("user", {}).get("userNam... | 190 | 310 | 608 | 918 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""LiveSpace (Videos)
.. hint::
This engine only search for **live streams**!
"""
from urllib.parse import urlencode
from datetime import datetime
from babel import dates
about = {
"website": 'https://live.space',
"wikidata_id": None,
"official_api_docume... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""LiveSpace (Videos)
.. hint::
This engine only search for **live streams**!
"""
from urllib.parse import urlencode
from datetime import datetime
from babel import dates
about = {
"website": 'https://live.space',
"wikidata_id": None,
"official_api_docume... | |
23,847 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/loc.py | 46,47 | 1,98 | response | 47,98 | 47,98 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Library of Congress: query Photo, Print and Drawing from API endpoint_
``photos``.
.. _endpoint: https://www.loc.gov/apis/json-and-yaml/requests/endpoints/
.. note::
Beside the ``photos`` endpoint_ there are more endpoints available / we are
looking forward for c... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Library of Congress: query Photo, Print and Drawing from API endpoint_
``photos``.
.. _endpoint: https://www.loc.gov/apis/json-and-yaml/requests/endpoints/
.. note::
Beside the ``photos`` endpoint_ there are more endpoints available / we are
looking forward for c... |
results = []
json_data = resp.json()
json_results = json_data.get('results')
if not json_results:
# when a search term has none results, loc sends a JSON in a HTTP 404
# response and the HTTP status code is set in the 'status' element.
if json_data.get('status') == 404:
... |
results = []
json_data = resp.json()
json_results = json_data.get('results')
if not json_results:
# when a search term has none results, loc sends a JSON in a HTTP 404
# response and the HTTP status code is set in the 'status' element.
if json_data.get('status') == 404:
... | 125 | 400 | 487 | 887 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Library of Congress: query Photo, Print and Drawing from API endpoint_
``photos``.
.. _endpoint: https://www.loc.gov/apis/json-and-yaml/requests/endpoints/
.. note::
Beside the ``photos`` endpoint_ there are more endpoints available / we are
looking forward for c... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Library of Congress: query Photo, Print and Drawing from API endpoint_
``photos``.
.. _endpoint: https://www.loc.gov/apis/json-and-yaml/requests/endpoints/
.. note::
Beside the ``photos`` endpoint_ there are more endpoints available / we are
looking forward for c... | |
23,848 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/mastodon.py | 50,51 | 1,80 | response | 51,80 | 51,80 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mastodon_ is an open source alternative to large social media platforms like
Twitter/X, Facebook, ...
Since it's federated and self-hostable, there's a large amount of available
instances, which can be chosen instead by modifying ``base_url``.
We use their official API_... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mastodon_ is an open source alternative to large social media platforms like
Twitter/X, Facebook, ...
Since it's federated and self-hostable, there's a large amount of available
instances, which can be chosen instead by modifying ``base_url``.
We use their official API_... | results = []
json = resp.json()
for result in json[mastodon_type]:
if mastodon_type == "accounts":
results.append(
{
'url': result['uri'],
'title': result['username'] + f" ({result['followers_count']} followers)",
... | results = []
json = resp.json()
for result in json[mastodon_type]:
if mastodon_type == "accounts":
results.append(
{
'url': result['uri'],
'title': result['username'] + f" ({result['followers_count']} followers)",
... | 78 | 501 | 326 | 827 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mastodon_ is an open source alternative to large social media platforms like
Twitter/X, Facebook, ...
Since it's federated and self-hostable, there's a large amount of available
instances, which can be chosen instead by modifying ``base_url``.
We use their official API_... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mastodon_ is an open source alternative to large social media platforms like
Twitter/X, Facebook, ...
Since it's federated and self-hostable, there's a large amount of available
instances, which can be chosen instead by modifying ``base_url``.
We use their official API_... | |
23,849 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/material_icons.py | 29,30 | 1,62 | response | 30,62 | 30,62 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Material Icons (images)
"""
import re
from json import loads
about = {
"website": 'https://fonts.google.com/icons',
"wikidata_id": 'Q107315222',
"official_api_documentation": None,
"use_official_api": False,
"require_api_key": False,
"results": ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Material Icons (images)
"""
import re
from json import loads
about = {
"website": 'https://fonts.google.com/icons',
"wikidata_id": 'Q107315222',
"official_api_documentation": None,
"use_official_api": False,
"require_api_key": False,
"results": ... | results = []
query = resp.search_params["query"].lower()
json_results = loads(resp.text[5:])
outlined = not re.findall(filled_regex, query)
query = re.sub(filled_regex, "", query).strip()
svg_type = "fill1" if not outlined else "default"
query_parts = query.split(" ")
for result in j... | results = []
query = resp.search_params["query"].lower()
json_results = loads(resp.text[5:])
outlined = not re.findall(filled_regex, query)
query = re.sub(filled_regex, "", query).strip()
svg_type = "fill1" if not outlined else "default"
query_parts = query.split(" ")
for result in j... | 100 | 346 | 361 | 707 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Material Icons (images)
"""
import re
from json import loads
about = {
"website": 'https://fonts.google.com/icons',
"wikidata_id": 'Q107315222',
"official_api_documentation": None,
"use_official_api": False,
"require_api_key": False,
"results": ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Material Icons (images)
"""
import re
from json import loads
about = {
"website": 'https://fonts.google.com/icons',
"wikidata_id": 'Q107315222',
"official_api_documentation": None,
"use_official_api": False,
"require_api_key": False,
"results": ... | |
23,850 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/mediathekviewweb.py | 25,26 | 1,76 | request | 26,51 | 26,51 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MediathekViewWeb (API)
"""
import datetime
from json import loads, dumps
about = {
"website": 'https://mediathekviewweb.de/',
"wikidata_id": 'Q27877380',
"official_api_documentation": 'https://gist.github.com/bagbag/a2888478d27de0e989cf777f81fb33de',
"u... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MediathekViewWeb (API)
"""
import datetime
from json import loads, dumps
about = {
"website": 'https://mediathekviewweb.de/',
"wikidata_id": 'Q27877380',
"official_api_documentation": 'https://gist.github.com/bagbag/a2888478d27de0e989cf777f81fb33de',
"u... |
params['url'] = 'https://mediathekviewweb.de/api/query'
params['method'] = 'POST'
params['headers']['Content-type'] = 'text/plain'
params['data'] = dumps(
{
'queries': [
{
'fields': [
'title',
'topic... |
params['url'] = 'https://mediathekviewweb.de/api/query'
params['method'] = 'POST'
params['headers']['Content-type'] = 'text/plain'
params['data'] = dumps(
{
'queries': [
{
'fields': [
'title',
'topic... | 43 | 456 | 197 | 653 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MediathekViewWeb (API)
"""
import datetime
from json import loads, dumps
about = {
"website": 'https://mediathekviewweb.de/',
"wikidata_id": 'Q27877380',
"official_api_documentation": 'https://gist.github.com/bagbag/a2888478d27de0e989cf777f81fb33de',
"u... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MediathekViewWeb (API)
"""
import datetime
from json import loads, dumps
about = {
"website": 'https://mediathekviewweb.de/',
"wikidata_id": 'Q27877380',
"official_api_documentation": 'https://gist.github.com/bagbag/a2888478d27de0e989cf777f81fb33de',
"u... | |
23,851 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/mediawiki.py | 143,144 | 1,180 | response | 144,180 | 144,180 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""The MediaWiki engine is a *generic* engine to **query** Wikimedia wikis by
the `MediaWiki Action API`_. For a `query action`_ all Wikimedia wikis have
endpoints that follow this pattern::
https://{base_url}/w/api.php?action=query&list=search&format=json
.. note::
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""The MediaWiki engine is a *generic* engine to **query** Wikimedia wikis by
the `MediaWiki Action API`_. For a `query action`_ all Wikimedia wikis have
endpoints that follow this pattern::
https://{base_url}/w/api.php?action=query&list=search&format=json
.. note::
... |
results = []
search_results = resp.json()
# return empty array if there are no results
if not search_results.get('query', {}).get('search'):
return []
for result in search_results['query']['search']:
if result.get('snippet', '').startswith('#REDIRECT'):
continue
... |
results = []
search_results = resp.json()
# return empty array if there are no results
if not search_results.get('query', {}).get('search'):
return []
for result in search_results['query']['search']:
if result.get('snippet', '').startswith('#REDIRECT'):
continue
... | 110 | 1,342 | 367 | 1,709 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""The MediaWiki engine is a *generic* engine to **query** Wikimedia wikis by
the `MediaWiki Action API`_. For a `query action`_ all Wikimedia wikis have
endpoints that follow this pattern::
https://{base_url}/w/api.php?action=query&list=search&format=json
.. note::
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""The MediaWiki engine is a *generic* engine to **query** Wikimedia wikis by
the `MediaWiki Action API`_. For a `query action`_ all Wikimedia wikis have
endpoints that follow this pattern::
https://{base_url}/w/api.php?action=query&list=search&format=json
.. note::
... | |
23,852 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/meilisearch.py | 57,58 | 1,88 | request | 58,78 | 58,78 | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- :origin:`meilisearch.py <searx/engines/meilisearch.py>`
- `MeiliSearch <https://www.meilisearch.com>`_
- `MeiliSearch Documentation <https://docs.meilisearch.com/>`_
- `Install MeiliSearch
<https://docs.meilisearch.com/learn/getting_s... | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- :origin:`meilisearch.py <searx/engines/meilisearch.py>`
- `MeiliSearch <https://www.meilisearch.com>`_
- `MeiliSearch Documentation <https://docs.meilisearch.com/>`_
- `Install MeiliSearch
<https://docs.meilisearch.com/learn/getting_s... | if auth_key != '':
params['headers']['X-Meili-API-Key'] = auth_key
params['headers']['Content-Type'] = 'application/json'
params['url'] = _search_url
params['method'] = 'POST'
data = {
'q': query,
'offset': 10 * (params['pageno'] - 1),
'limit': 10,
}
if len(... | if auth_key != '':
params['headers']['X-Meili-API-Key'] = auth_key
params['headers']['Content-Type'] = 'application/json'
params['url'] = _search_url
params['method'] = 'POST'
data = {
'q': query,
'offset': 10 * (params['pageno'] - 1),
'limit': 10,
}
if len(... | 42 | 565 | 181 | 746 | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- :origin:`meilisearch.py <searx/engines/meilisearch.py>`
- `MeiliSearch <https://www.meilisearch.com>`_
- `MeiliSearch Documentation <https://docs.meilisearch.com/>`_
- `Install MeiliSearch
<https://docs.meilisearch.com/learn/getting_s... | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- :origin:`meilisearch.py <searx/engines/meilisearch.py>`
- `MeiliSearch <https://www.meilisearch.com>`_
- `MeiliSearch Documentation <https://docs.meilisearch.com/>`_
- `Install MeiliSearch
<https://docs.meilisearch.com/learn/getting_s... | |
23,853 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/metacpan.py | 53,54 | 1,79 | request | 54,63 | 54,63 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""metacpan
"""
from urllib.parse import urlunparse
from json import dumps
# about
about = {
"website": 'https://metacpan.org/',
"wikidata_id": 'Q841507',
"official_api_documentation": 'https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md',
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""metacpan
"""
from urllib.parse import urlunparse
from json import dumps
# about
about = {
"website": 'https://metacpan.org/',
"wikidata_id": 'Q841507',
"official_api_documentation": 'https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md',
... | params["url"] = search_url
params["method"] = "POST"
query_data = query_data_template
query_data["query"]["multi_match"]["query"] = query
query_data["from"] = (params["pageno"] - 1) * number_of_results
params["data"] = dumps(query_data)
return params
| params["url"] = search_url
params["method"] = "POST"
query_data = query_data_template
query_data["query"]["multi_match"]["query"] = query
query_data["from"] = (params["pageno"] - 1) * number_of_results
params["data"] = dumps(query_data)
return params
| 24 | 587 | 104 | 691 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""metacpan
"""
from urllib.parse import urlunparse
from json import dumps
# about
about = {
"website": 'https://metacpan.org/',
"wikidata_id": 'Q841507',
"official_api_documentation": 'https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md',
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""metacpan
"""
from urllib.parse import urlunparse
from json import dumps
# about
about = {
"website": 'https://metacpan.org/',
"wikidata_id": 'Q841507',
"official_api_documentation": 'https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md',
... | |
23,854 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/mixcloud.py | 35,36 | 1,54 | response | 36,54 | 36,54 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mixcloud (Music)
"""
from urllib.parse import urlencode
from dateutil import parser
# about
about = {
"website": 'https://www.mixcloud.com/',
"wikidata_id": 'Q6883832',
"official_api_documentation": 'http://www.mixcloud.com/developers/',
"use_official_a... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mixcloud (Music)
"""
from urllib.parse import urlencode
from dateutil import parser
# about
about = {
"website": 'https://www.mixcloud.com/',
"wikidata_id": 'Q6883832',
"official_api_documentation": 'http://www.mixcloud.com/developers/',
"use_official_a... | results = []
search_res = resp.json()
for result in search_res.get('data', []):
r_url = result['url']
publishedDate = parser.parse(result['created_time'])
res = {
'url': r_url,
'title': result['name'],
'iframe_src': iframe_src.format(url=r_url),
... | results = []
search_res = resp.json()
for result in search_res.get('data', []):
r_url = result['url']
publishedDate = parser.parse(result['created_time'])
res = {
'url': r_url,
'title': result['name'],
'iframe_src': iframe_src.format(url=r_url),
... | 36 | 323 | 169 | 492 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mixcloud (Music)
"""
from urllib.parse import urlencode
from dateutil import parser
# about
about = {
"website": 'https://www.mixcloud.com/',
"wikidata_id": 'Q6883832',
"official_api_documentation": 'http://www.mixcloud.com/developers/',
"use_official_a... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mixcloud (Music)
"""
from urllib.parse import urlencode
from dateutil import parser
# about
about = {
"website": 'https://www.mixcloud.com/',
"wikidata_id": 'Q6883832',
"official_api_documentation": 'http://www.mixcloud.com/developers/',
"use_official_a... | |
23,855 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/mongodb.py | 75,76 | 1,103 | connect | 76,85 | 76,85 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MongoDB_ is a document based database program that handles JSON like data.
Before configuring the ``mongodb`` engine, you must install the dependency
pymongo_.
Configuration
=============
In order to query MongoDB_, you have to select a ``database`` and a
``collection``... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MongoDB_ is a document based database program that handles JSON like data.
Before configuring the ``mongodb`` engine, you must install the dependency
pymongo_.
Configuration
=============
In order to query MongoDB_, you have to select a ``database`` and a
``collection``... | global _client # pylint: disable=global-statement
kwargs = {'port': port}
if username:
kwargs['username'] = username
if password:
kwargs['password'] = password
_client = MongoClient(host, **kwargs)[database][collection]
| global _client # pylint: disable=global-statement
kwargs = {'port': port}
if username:
kwargs['username'] = username
if password:
kwargs['password'] = password
_client = MongoClient(host, **kwargs)[database][collection]
| 23 | 690 | 86 | 776 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MongoDB_ is a document based database program that handles JSON like data.
Before configuring the ``mongodb`` engine, you must install the dependency
pymongo_.
Configuration
=============
In order to query MongoDB_, you have to select a ``database`` and a
``collection``... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MongoDB_ is a document based database program that handles JSON like data.
Before configuring the ``mongodb`` engine, you must install the dependency
pymongo_.
Configuration
=============
In order to query MongoDB_, you have to select a ``database`` and a
``collection``... | |
23,856 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/moviepilot.py | 49,50 | 1,116 | request | 50,85 | 50,85 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Moviepilot is a German movie database, similar to IMDB or TMDB. It doesn't
have any official API, but it uses JSON requests internally to fetch search
results and suggestions, that's being used in this implementation.
Moviepilot additionally allows to discover movies by... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Moviepilot is a German movie database, similar to IMDB or TMDB. It doesn't
have any official API, but it uses JSON requests internally to fetch search
results and suggestions, that's being used in this implementation.
Moviepilot additionally allows to discover movies by... | query_parts = query.split(" ")
discovery_filters = []
for query_part in query_parts:
filter_category_and_value = query_part.split("-", 1)
if len(filter_category_and_value) < 2:
continue
filter_category = filter_category_and_value[0]
if filter_category in filte... | query_parts = query.split(" ")
discovery_filters = []
for query_part in query_parts:
filter_category_and_value = query_part.split("-", 1)
if len(filter_category_and_value) < 2:
continue
filter_category = filter_category_and_value[0]
if filter_category in filte... | 69 | 853 | 335 | 1,188 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Moviepilot is a German movie database, similar to IMDB or TMDB. It doesn't
have any official API, but it uses JSON requests internally to fetch search
results and suggestions, that's being used in this implementation.
Moviepilot additionally allows to discover movies by... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Moviepilot is a German movie database, similar to IMDB or TMDB. It doesn't
have any official API, but it uses JSON requests internally to fetch search
results and suggestions, that's being used in this implementation.
Moviepilot additionally allows to discover movies by... | |
23,857 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/mozhi.py | 34,35 | 1,59 | response | 35,59 | 35,59 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mozhi (alternative frontend for popular translation engines)"""
import random
import re
from urllib.parse import urlencode
about = {
"website": 'https://codeberg.org/aryak/mozhi',
"wikidata_id": None,
"official_api_documentation": 'https://mozhi.aryak.me/api... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mozhi (alternative frontend for popular translation engines)"""
import random
import re
from urllib.parse import urlencode
about = {
"website": 'https://codeberg.org/aryak/mozhi',
"wikidata_id": None,
"official_api_documentation": 'https://mozhi.aryak.me/api... | translation = resp.json()
infobox = ""
if translation['target_transliteration'] and not re.match(
re_transliteration_unsupported, translation['target_transliteration']
):
infobox = f"<b>{translation['target_transliteration']}</b>"
if translation['word_choices']:
for word i... | translation = resp.json()
infobox = ""
if translation['target_transliteration'] and not re.match(
re_transliteration_unsupported, translation['target_transliteration']
):
infobox = f"<b>{translation['target_transliteration']}</b>"
if translation['word_choices']:
for word i... | 48 | 352 | 251 | 603 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mozhi (alternative frontend for popular translation engines)"""
import random
import re
from urllib.parse import urlencode
about = {
"website": 'https://codeberg.org/aryak/mozhi',
"wikidata_id": None,
"official_api_documentation": 'https://mozhi.aryak.me/api... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mozhi (alternative frontend for popular translation engines)"""
import random
import re
from urllib.parse import urlencode
about = {
"website": 'https://codeberg.org/aryak/mozhi',
"wikidata_id": None,
"official_api_documentation": 'https://mozhi.aryak.me/api... | |
23,858 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/mrs.py | 54,55 | 1,71 | response | 55,71 | 55,71 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Matrix Rooms Search - a fully-featured, standalone, matrix rooms search service.
Configuration
=============
The engine has the following mandatory settings:
- :py:obj:`base_url`
.. code:: yaml
- name: MRS
engine: mrs
base_url: https://mrs-host
...
Imp... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Matrix Rooms Search - a fully-featured, standalone, matrix rooms search service.
Configuration
=============
The engine has the following mandatory settings:
- :py:obj:`base_url`
.. code:: yaml
- name: MRS
engine: mrs
base_url: https://mrs-host
...
Imp... | results = []
for result in resp.json():
results.append(
{
'url': matrix_url + '/#/' + result['alias'],
'title': result['name'],
'content': result['topic']
+ f" // {result['members']} members"
+ f" // {result['al... | results = []
for result in resp.json():
results.append(
{
'url': matrix_url + '/#/' + result['alias'],
'title': result['name'],
'content': result['topic']
+ f" // {result['members']} members"
+ f" // {result['al... | 38 | 445 | 139 | 584 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Matrix Rooms Search - a fully-featured, standalone, matrix rooms search service.
Configuration
=============
The engine has the following mandatory settings:
- :py:obj:`base_url`
.. code:: yaml
- name: MRS
engine: mrs
base_url: https://mrs-host
...
Imp... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Matrix Rooms Search - a fully-featured, standalone, matrix rooms search service.
Configuration
=============
The engine has the following mandatory settings:
- :py:obj:`base_url`
.. code:: yaml
- name: MRS
engine: mrs
base_url: https://mrs-host
...
Imp... | |
23,859 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/mwmbl.py | 35,36 | 1,51 | response | 36,51 | 36,51 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mwmbl_ is a non-profit, ad-free, free-libre and free-lunch search engine with
a focus on useability and speed.
.. hint::
At the moment it is little more than an idea together with a proof of concept
implementation of the web front-end and search technology on a sm... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mwmbl_ is a non-profit, ad-free, free-libre and free-lunch search engine with
a focus on useability and speed.
.. hint::
At the moment it is little more than an idea together with a proof of concept
implementation of the web front-end and search technology on a sm... | results = []
json_results = resp.json()
for result in json_results:
title_parts = [title['value'] for title in result['title']]
results.append(
{
'url': result['url'],
'title': ''.join(title_parts),
'content': result['extract'][0]... | results = []
json_results = resp.json()
for result in json_results:
title_parts = [title['value'] for title in result['title']]
results.append(
{
'url': result['url'],
'title': ''.join(title_parts),
'content': result['extract'][0]... | 29 | 317 | 118 | 435 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mwmbl_ is a non-profit, ad-free, free-libre and free-lunch search engine with
a focus on useability and speed.
.. hint::
At the moment it is little more than an idea together with a proof of concept
implementation of the web front-end and search technology on a sm... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Mwmbl_ is a non-profit, ad-free, free-libre and free-lunch search engine with
a focus on useability and speed.
.. hint::
At the moment it is little more than an idea together with a proof of concept
implementation of the web front-end and search technology on a sm... | |
23,860 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/mysql_server.py | 49,50 | 1,86 | init | 50,68 | 50,68 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MySQL is said to be the most popular open source database. Before enabling
MySQL engine, you must install the package ``mysql-connector-python``.
The authentication plugin is configurable by setting ``auth_plugin`` in the
attributes. By default it is set to ``caching_s... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MySQL is said to be the most popular open source database. Before enabling
MySQL engine, you must install the package ``mysql-connector-python``.
The authentication plugin is configurable by setting ``auth_plugin`` in the
attributes. By default it is set to ``caching_s... | global _connection # pylint: disable=global-statement
if 'query_str' not in engine_settings:
raise ValueError('query_str cannot be empty')
if not engine_settings['query_str'].lower().startswith('select '):
raise ValueError('only SELECT query is supported')
_connection = mysql.connect... | global _connection # pylint: disable=global-statement
if 'query_str' not in engine_settings:
raise ValueError('query_str cannot be empty')
if not engine_settings['query_str'].lower().startswith('select '):
raise ValueError('only SELECT query is supported')
_connection = mysql.connect... | 35 | 520 | 154 | 674 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MySQL is said to be the most popular open source database. Before enabling
MySQL engine, you must install the package ``mysql-connector-python``.
The authentication plugin is configurable by setting ``auth_plugin`` in the
attributes. By default it is set to ``caching_s... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MySQL is said to be the most popular open source database. Before enabling
MySQL engine, you must install the package ``mysql-connector-python``.
The authentication plugin is configurable by setting ``auth_plugin`` in the
attributes. By default it is set to ``caching_s... | |
23,861 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/npm.py | 41,42 | 1,67 | response | 42,67 | 42,67 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""npms.io
"""
from urllib.parse import urlencode
from dateutil import parser
about = {
"website": "https://npms.io/",
"wikidata_id": "Q7067518",
"official_api_documentation": "https://api-docs.npms.io/",
"use_official_api": False,
"require_api_key": ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""npms.io
"""
from urllib.parse import urlencode
from dateutil import parser
about = {
"website": "https://npms.io/",
"wikidata_id": "Q7067518",
"official_api_documentation": "https://api-docs.npms.io/",
"use_official_api": False,
"require_api_key": ... | results = []
content = resp.json()
for entry in content["results"]:
package = entry["package"]
publishedDate = package.get("date")
if publishedDate:
publishedDate = parser.parse(publishedDate)
tags = list(entry.get("flags", {}).keys()) + package.get("keywords", []... | results = []
content = resp.json()
for entry in content["results"]:
package = entry["package"]
publishedDate = package.get("date")
if publishedDate:
publishedDate = parser.parse(publishedDate)
tags = list(entry.get("flags", {}).keys()) + package.get("keywords", []... | 58 | 294 | 264 | 558 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""npms.io
"""
from urllib.parse import urlencode
from dateutil import parser
about = {
"website": "https://npms.io/",
"wikidata_id": "Q7067518",
"official_api_documentation": "https://api-docs.npms.io/",
"use_official_api": False,
"require_api_key": ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""npms.io
"""
from urllib.parse import urlencode
from dateutil import parser
about = {
"website": "https://npms.io/",
"wikidata_id": "Q7067518",
"official_api_documentation": "https://api-docs.npms.io/",
"use_official_api": False,
"require_api_key": ... | |
23,862 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/open_meteo.py | 28,29 | 1,119 | request | 29,55 | 29,55 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Open Meteo (weather)"""
from urllib.parse import urlencode, quote_plus
from datetime import datetime
from flask_babel import gettext
from searx.network import get
from searx.exceptions import SearxEngineAPIException
about = {
"website": 'https://open-meteo.com',
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Open Meteo (weather)"""
from urllib.parse import urlencode, quote_plus
from datetime import datetime
from flask_babel import gettext
from searx.network import get
from searx.exceptions import SearxEngineAPIException
about = {
"website": 'https://open-meteo.com',
... | location_url = f"{geo_url}/v1/search?name={quote_plus(query)}"
resp = get(location_url)
if resp.status_code != 200:
raise SearxEngineAPIException("invalid geo location response code")
json_locations = resp.json().get("results", [])
if len(json_locations) == 0:
raise SearxEngineAPIE... | location_url = f"{geo_url}/v1/search?name={quote_plus(query)}"
resp = get(location_url)
if resp.status_code != 200:
raise SearxEngineAPIException("invalid geo location response code")
json_locations = resp.json().get("results", [])
if len(json_locations) == 0:
raise SearxEngineAPIE... | 54 | 1,071 | 271 | 1,342 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Open Meteo (weather)"""
from urllib.parse import urlencode, quote_plus
from datetime import datetime
from flask_babel import gettext
from searx.network import get
from searx.exceptions import SearxEngineAPIException
about = {
"website": 'https://open-meteo.com',
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Open Meteo (weather)"""
from urllib.parse import urlencode, quote_plus
from datetime import datetime
from flask_babel import gettext
from searx.network import get
from searx.exceptions import SearxEngineAPIException
about = {
"website": 'https://open-meteo.com',
... | |
23,863 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/opensemantic.py | 32,33 | 1,47 | response | 33,47 | 33,47 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Open Semantic Search
"""
from json import loads
from urllib.parse import quote
from dateutil import parser
# about
about = {
"website": 'https://www.opensemanticsearch.org/',
"wikidata_id": None,
"official_api_documentation": 'https://www.opensemanticsearch... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Open Semantic Search
"""
from json import loads
from urllib.parse import quote
from dateutil import parser
# about
about = {
"website": 'https://www.opensemanticsearch.org/',
"wikidata_id": None,
"official_api_documentation": 'https://www.opensemanticsearch... | results = []
data = loads(resp.text)
docs = data.get('response', {}).get('docs', [])
for current in docs:
item = {}
item['url'] = current['id']
item['title'] = current['title_txt_txt_en']
if current.get('content_txt'):
item['content'] = current['content_txt']... | results = []
data = loads(resp.text)
docs = data.get('response', {}).get('docs', [])
for current in docs:
item = {}
item['url'] = current['id']
item['title'] = current['title_txt_txt_en']
if current.get('content_txt'):
item['content'] = current['content_txt']... | 35 | 257 | 152 | 409 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Open Semantic Search
"""
from json import loads
from urllib.parse import quote
from dateutil import parser
# about
about = {
"website": 'https://www.opensemanticsearch.org/',
"wikidata_id": None,
"official_api_documentation": 'https://www.opensemanticsearch... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Open Semantic Search
"""
from json import loads
from urllib.parse import quote
from dateutil import parser
# about
about = {
"website": 'https://www.opensemanticsearch.org/',
"wikidata_id": None,
"official_api_documentation": 'https://www.opensemanticsearch... | |
23,865 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/openverse.py | 39,40 | 1,55 | response | 40,55 | 40,55 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Openverse (formerly known as: Creative Commons search engine) [Images]
"""
from json import loads
from urllib.parse import urlencode
about = {
"website": 'https://wordpress.org/openverse/',
"wikidata_id": None,
"official_api_documentation": 'https://api... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Openverse (formerly known as: Creative Commons search engine) [Images]
"""
from json import loads
from urllib.parse import urlencode
about = {
"website": 'https://wordpress.org/openverse/',
"wikidata_id": None,
"official_api_documentation": 'https://api... | results = []
json_data = loads(resp.text)
for result in json_data['results']:
results.append(
{
'url': result['foreign_landing_url'],
'title': result['title'],
'img_src': result['url'],
'template': 'images.html',
... | results = []
json_data = loads(resp.text)
for result in json_data['results']:
results.append(
{
'url': result['foreign_landing_url'],
'title': result['title'],
'img_src': result['url'],
'template': 'images.html',
... | 24 | 322 | 111 | 433 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Openverse (formerly known as: Creative Commons search engine) [Images]
"""
from json import loads
from urllib.parse import urlencode
about = {
"website": 'https://wordpress.org/openverse/',
"wikidata_id": None,
"official_api_documentation": 'https://api... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Openverse (formerly known as: Creative Commons search engine) [Images]
"""
from json import loads
from urllib.parse import urlencode
about = {
"website": 'https://wordpress.org/openverse/',
"wikidata_id": None,
"official_api_documentation": 'https://api... | |
23,866 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/pdbe.py | 33,34 | 1,123 | request | 34,41 | 34,41 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
PDBe (Protein Data Bank in Europe)
"""
from json import loads
from flask_babel import gettext
# about
about = {
"website": 'https://www.ebi.ac.uk/pdbe',
"wikidata_id": 'Q55823905',
"official_api_documentation": 'https://www.ebi.ac.uk/pdbe/api/doc/search.ht... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
PDBe (Protein Data Bank in Europe)
"""
from json import loads
from flask_babel import gettext
# about
about = {
"website": 'https://www.ebi.ac.uk/pdbe',
"wikidata_id": 'Q55823905',
"official_api_documentation": 'https://www.ebi.ac.uk/pdbe/api/doc/search.ht... |
params['url'] = pdbe_solr_url
params['method'] = 'POST'
params['data'] = {'q': query, 'wt': "json"} # request response in parsable format
return params
|
params['url'] = pdbe_solr_url
params['method'] = 'POST'
params['data'] = {'q': query, 'wt': "json"} # request response in parsable format
return params
| 20 | 1,167 | 66 | 1,233 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
PDBe (Protein Data Bank in Europe)
"""
from json import loads
from flask_babel import gettext
# about
about = {
"website": 'https://www.ebi.ac.uk/pdbe',
"wikidata_id": 'Q55823905',
"official_api_documentation": 'https://www.ebi.ac.uk/pdbe/api/doc/search.ht... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
PDBe (Protein Data Bank in Europe)
"""
from json import loads
from flask_babel import gettext
# about
about = {
"website": 'https://www.ebi.ac.uk/pdbe',
"wikidata_id": 'Q55823905',
"official_api_documentation": 'https://www.ebi.ac.uk/pdbe/api/doc/search.ht... | |
23,867 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/photon.py | 35,36 | 1,144 | request | 36,50 | 36,50 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Photon (Map)
"""
from json import loads
from urllib.parse import urlencode
from searx.utils import searx_useragent
# about
about = {
"website": 'https://photon.komoot.io',
"wikidata_id": None,
"official_api_documentation": 'https://photon.komoot.io/',
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Photon (Map)
"""
from json import loads
from urllib.parse import urlencode
from searx.utils import searx_useragent
# about
about = {
"website": 'https://photon.komoot.io',
"wikidata_id": None,
"official_api_documentation": 'https://photon.komoot.io/',
... | params['url'] = base_url + search_string.format(query=urlencode({'q': query}), limit=number_of_results)
if params['language'] != 'all':
language = params['language'].split('_')[0]
if language in supported_languages:
params['url'] = params['url'] + "&lang=" + language
# using se... | params['url'] = base_url + search_string.format(query=urlencode({'q': query}), limit=number_of_results)
if params['language'] != 'all':
language = params['language'].split('_')[0]
if language in supported_languages:
params['url'] = params['url'] + "&lang=" + language
# using se... | 39 | 1,077 | 150 | 1,227 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Photon (Map)
"""
from json import loads
from urllib.parse import urlencode
from searx.utils import searx_useragent
# about
about = {
"website": 'https://photon.komoot.io',
"wikidata_id": None,
"official_api_documentation": 'https://photon.komoot.io/',
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Photon (Map)
"""
from json import loads
from urllib.parse import urlencode
from searx.utils import searx_useragent
# about
about = {
"website": 'https://photon.komoot.io',
"wikidata_id": None,
"official_api_documentation": 'https://photon.komoot.io/',
... | |
23,868 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/pinterest.py | 35,36 | 1,67 | response | 36,67 | 36,67 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Pinterest (images)
"""
from json import dumps
about = {
"website": 'https://www.pinterest.com/',
"wikidata_id": 'Q255381',
"official_api_documentation": 'https://developers.pinterest.com/docs/api/v5/',
"use_official_api": False,
"require_api_key": Fa... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Pinterest (images)
"""
from json import dumps
about = {
"website": 'https://www.pinterest.com/',
"wikidata_id": 'Q255381',
"official_api_documentation": 'https://developers.pinterest.com/docs/api/v5/',
"use_official_api": False,
"require_api_key": Fa... | results = []
json_resp = resp.json()
results.append(
{
'engine_data': json_resp['resource_response']['bookmark'],
# it's called bookmark by pinterest, but it's rather a nextpage
# parameter to get the next results
'key': 'bookmark',
}
)
... | results = []
json_resp = resp.json()
results.append(
{
'engine_data': json_resp['resource_response']['bookmark'],
# it's called bookmark by pinterest, but it's rather a nextpage
# parameter to get the next results
'key': 'bookmark',
}
)
... | 71 | 285 | 312 | 597 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Pinterest (images)
"""
from json import dumps
about = {
"website": 'https://www.pinterest.com/',
"wikidata_id": 'Q255381',
"official_api_documentation": 'https://developers.pinterest.com/docs/api/v5/',
"use_official_api": False,
"require_api_key": Fa... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Pinterest (images)
"""
from json import dumps
about = {
"website": 'https://www.pinterest.com/',
"wikidata_id": 'Q255381',
"official_api_documentation": 'https://developers.pinterest.com/docs/api/v5/',
"use_official_api": False,
"require_api_key": Fa... | |
23,869 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/piped.py | 126,127 | 1,166 | response | 127,166 | 127,166 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""An alternative privacy-friendly YouTube frontend which is efficient by
design. `Piped’s architecture`_ consists of 3 components:
- :py:obj:`backend <backend_url>`
- :py:obj:`frontend <frontend_url>`
- proxy
.. _Piped’s architecture: https://docs.piped.video/docs/archit... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""An alternative privacy-friendly YouTube frontend which is efficient by
design. `Piped’s architecture`_ consists of 3 components:
- :py:obj:`backend <backend_url>`
- :py:obj:`frontend <frontend_url>`
- proxy
.. _Piped’s architecture: https://docs.piped.video/docs/archit... | results = []
json = resp.json()
for result in json["items"]:
# note: piped returns -1 for all upload times when filtering for music
uploaded = result.get("uploaded", -1)
item = {
# the api url differs from the frontend, hence use piped.video as default
"url... | results = []
json = resp.json()
for result in json["items"]:
# note: piped returns -1 for all upload times when filtering for music
uploaded = result.get("uploaded", -1)
item = {
# the api url differs from the frontend, hence use piped.video as default
"url... | 135 | 1,150 | 444 | 1,594 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""An alternative privacy-friendly YouTube frontend which is efficient by
design. `Piped’s architecture`_ consists of 3 components:
- :py:obj:`backend <backend_url>`
- :py:obj:`frontend <frontend_url>`
- proxy
.. _Piped’s architecture: https://docs.piped.video/docs/archit... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""An alternative privacy-friendly YouTube frontend which is efficient by
design. `Piped’s architecture`_ consists of 3 components:
- :py:obj:`backend <backend_url>`
- :py:obj:`frontend <frontend_url>`
- proxy
.. _Piped’s architecture: https://docs.piped.video/docs/archit... | |
23,870 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/piratebay.py | 56,57 | 1,100 | response | 57,100 | 57,100 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Piratebay (Videos, Music, Files)
"""
from json import loads
from datetime import datetime
from operator import itemgetter
from urllib.parse import quote
from searx.utils import get_torrent_size
# about
about = {
"website": 'https://thepiratebay.org',
"wikidat... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Piratebay (Videos, Music, Files)
"""
from json import loads
from datetime import datetime
from operator import itemgetter
from urllib.parse import quote
from searx.utils import get_torrent_size
# about
about = {
"website": 'https://thepiratebay.org',
"wikidat... | results = []
search_res = loads(resp.text)
# return empty array if nothing is found
if search_res[0]["name"] == "No results returned":
return []
# parse results
for result in search_res:
link = url + "description.php?id=" + result["id"]
magnetlink = (
"magn... | results = []
search_res = loads(resp.text)
# return empty array if nothing is found
if search_res[0]["name"] == "No results returned":
return []
# parse results
for result in search_res:
link = url + "description.php?id=" + result["id"]
magnetlink = (
"magn... | 120 | 585 | 419 | 1,004 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Piratebay (Videos, Music, Files)
"""
from json import loads
from datetime import datetime
from operator import itemgetter
from urllib.parse import quote
from searx.utils import get_torrent_size
# about
about = {
"website": 'https://thepiratebay.org',
"wikidat... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Piratebay (Videos, Music, Files)
"""
from json import loads
from datetime import datetime
from operator import itemgetter
from urllib.parse import quote
from searx.utils import get_torrent_size
# about
about = {
"website": 'https://thepiratebay.org',
"wikidat... | |
23,871 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/pixiv.py | 42,43 | 1,72 | response | 43,72 | 43,72 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Pixiv (images)"""
from urllib.parse import urlencode
import random
# Engine metadata
about = {
"website": 'https://www.pixiv.net/',
"wikidata_id": 'Q306956',
"official_api_documentation": None,
"use_official_api": False,
"require_api_key": False,
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Pixiv (images)"""
from urllib.parse import urlencode
import random
# Engine metadata
about = {
"website": 'https://www.pixiv.net/',
"wikidata_id": 'Q306956',
"official_api_documentation": None,
"use_official_api": False,
"require_api_key": False,
... | results = []
data = resp.json()
for item in data["body"]["illust"]["data"]:
image_url = item["url"]
pixiv_proxy = random.choice(pixiv_image_proxies)
proxy_image_url = image_url.replace("https://i.pximg.net", pixiv_proxy)
proxy_full_image_url = (
proxy_image_url.... | results = []
data = resp.json()
for item in data["body"]["illust"]["data"]:
image_url = item["url"]
pixiv_proxy = random.choice(pixiv_image_proxies)
proxy_image_url = image_url.replace("https://i.pximg.net", pixiv_proxy)
proxy_full_image_url = (
proxy_image_url.... | 56 | 339 | 359 | 698 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Pixiv (images)"""
from urllib.parse import urlencode
import random
# Engine metadata
about = {
"website": 'https://www.pixiv.net/',
"wikidata_id": 'Q306956',
"official_api_documentation": None,
"use_official_api": False,
"require_api_key": False,
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Pixiv (images)"""
from urllib.parse import urlencode
import random
# Engine metadata
about = {
"website": 'https://www.pixiv.net/',
"wikidata_id": 'Q306956',
"official_api_documentation": None,
"use_official_api": False,
"require_api_key": False,
... | |
23,872 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/pkg_go_dev.py | 51,52 | 1,85 | response | 52,85 | 52,85 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""pkg.go.dev (packages)"""
import re
from urllib.parse import urlencode
from dateutil import parser
import babel
import flask_babel
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
about = {
'website': 'https://pkg.go.dev/',
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""pkg.go.dev (packages)"""
import re
from urllib.parse import urlencode
from dateutil import parser
import babel
import flask_babel
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
about = {
'website': 'https://pkg.go.dev/',
... | results = []
doc = html.fromstring(resp.text)
for result in eval_xpath_list(doc, results_xpath):
publishedDate = extract_text(eval_xpath(result, updated_xpath))
try:
publishedDate = parser.parse(publishedDate)
except parser.ParserError:
publishedDate = None
... | results = []
doc = html.fromstring(resp.text)
for result in eval_xpath_list(doc, results_xpath):
publishedDate = extract_text(eval_xpath(result, updated_xpath))
try:
publishedDate = parser.parse(publishedDate)
except parser.ParserError:
publishedDate = None
... | 88 | 656 | 465 | 1,121 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""pkg.go.dev (packages)"""
import re
from urllib.parse import urlencode
from dateutil import parser
import babel
import flask_babel
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
about = {
'website': 'https://pkg.go.dev/',
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""pkg.go.dev (packages)"""
import re
from urllib.parse import urlencode
from dateutil import parser
import babel
import flask_babel
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
about = {
'website': 'https://pkg.go.dev/',
... | |
23,873 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/podcastindex.py | 20,21 | 1,43 | request | 21,25 | 21,25 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Podcast Index
"""
from urllib.parse import quote_plus
from datetime import datetime
about = {
'website': 'https://podcastindex.org',
'official_api_documentation': None, # requires an account
'use_official_api': False,
'require_api_key': False,
'resu... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Podcast Index
"""
from urllib.parse import quote_plus
from datetime import datetime
about = {
'website': 'https://podcastindex.org',
'official_api_documentation': None, # requires an account
'use_official_api': False,
'require_api_key': False,
'resu... | params['url'] = f"{base_url}/api/search/byterm?q={quote_plus(query)}"
return params
| params['url'] = f"{base_url}/api/search/byterm?q={quote_plus(query)}"
return params
| 5 | 289 | 41 | 330 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Podcast Index
"""
from urllib.parse import quote_plus
from datetime import datetime
about = {
'website': 'https://podcastindex.org',
'official_api_documentation': None, # requires an account
'use_official_api': False,
'require_api_key': False,
'resu... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Podcast Index
"""
from urllib.parse import quote_plus
from datetime import datetime
about = {
'website': 'https://podcastindex.org',
'official_api_documentation': None, # requires an account
'use_official_api': False,
'require_api_key': False,
'resu... | |
23,874 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/postgresql.py | 44,45 | 1,89 | init | 45,62 | 45,62 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""PostgreSQL is a powerful and robust open source database. Before configuring
the PostgreSQL engine, you must install the dependency ``psychopg2``.
Example
=======
Below is an example configuration:
.. code:: yaml
- name: my_database
engine: postgresql
da... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""PostgreSQL is a powerful and robust open source database. Before configuring
the PostgreSQL engine, you must install the dependency ``psychopg2``.
Example
=======
Below is an example configuration:
.. code:: yaml
- name: my_database
engine: postgresql
da... | global _connection # pylint: disable=global-statement
if 'query_str' not in engine_settings:
raise ValueError('query_str cannot be empty')
if not engine_settings['query_str'].lower().startswith('select '):
raise ValueError('only SELECT query is supported')
_connection = psycopg2.conn... | global _connection # pylint: disable=global-statement
if 'query_str' not in engine_settings:
raise ValueError('query_str cannot be empty')
if not engine_settings['query_str'].lower().startswith('select '):
raise ValueError('only SELECT query is supported')
_connection = psycopg2.conn... | 34 | 513 | 143 | 656 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""PostgreSQL is a powerful and robust open source database. Before configuring
the PostgreSQL engine, you must install the dependency ``psychopg2``.
Example
=======
Below is an example configuration:
.. code:: yaml
- name: my_database
engine: postgresql
da... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""PostgreSQL is a powerful and robust open source database. Before configuring
the PostgreSQL engine, you must install the dependency ``psychopg2``.
Example
=======
Below is an example configuration:
.. code:: yaml
- name: my_database
engine: postgresql
da... | |
23,876 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/pubmed.py | 56,57 | 1,133 | response | 57,133 | 57,133 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""PubMed (Scholar publications)
"""
from datetime import datetime
from urllib.parse import urlencode
from lxml import etree
from searx.network import get
from searx.utils import (
eval_xpath_getindex,
eval_xpath_list,
extract_text,
)
# about
about = {
"w... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""PubMed (Scholar publications)
"""
from datetime import datetime
from urllib.parse import urlencode
from lxml import etree
from searx.network import get
from searx.utils import (
eval_xpath_getindex,
eval_xpath_list,
extract_text,
)
# about
about = {
"w... | results = []
# First retrieve notice of each result
pubmed_retrieve_api_url = (
'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?' + 'db=pubmed&retmode=xml&id={pmids_string}'
)
pmids_results = etree.XML(resp.content)
pmids = pmids_results.xpath('//eSearchResult/IdList/Id')
... | results = []
# First retrieve notice of each result
pubmed_retrieve_api_url = (
'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?' + 'db=pubmed&retmode=xml&id={pmids_string}'
)
pmids_results = etree.XML(resp.content)
pmids = pmids_results.xpath('//eSearchResult/IdList/Id')
... | 232 | 524 | 1,078 | 1,602 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""PubMed (Scholar publications)
"""
from datetime import datetime
from urllib.parse import urlencode
from lxml import etree
from searx.network import get
from searx.utils import (
eval_xpath_getindex,
eval_xpath_list,
extract_text,
)
# about
about = {
"w... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""PubMed (Scholar publications)
"""
from datetime import datetime
from urllib.parse import urlencode
from lxml import etree
from searx.network import get
from searx.utils import (
eval_xpath_getindex,
eval_xpath_list,
extract_text,
)
# about
about = {
"w... | |
23,877 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/pypi.py | 44,45 | 1,68 | response | 45,68 | 45,68 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""pypi.org
"""
from urllib.parse import urlencode
from dateutil import parser
from lxml import html
from searx.utils import (
eval_xpath_getindex,
eval_xpath_list,
extract_text,
)
# about
about = {
"website": "https://pypi.org",
"wikidata_id": "Q2984... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""pypi.org
"""
from urllib.parse import urlencode
from dateutil import parser
from lxml import html
from searx.utils import (
eval_xpath_getindex,
eval_xpath_list,
extract_text,
)
# about
about = {
"website": "https://pypi.org",
"wikidata_id": "Q2984... | results = []
dom = html.fromstring(resp.text)
for entry in eval_xpath_list(dom, '/html/body/main/div/div/div/form/div/ul/li/a[@class="package-snippet"]'):
url = base_url + extract_text(eval_xpath_getindex(entry, './@href', 0)) # type: ignore
title = extract_text(eval_xpath_getindex(entry, '... | results = []
dom = html.fromstring(resp.text)
for entry in eval_xpath_list(dom, '/html/body/main/div/div/div/form/div/ul/li/a[@class="package-snippet"]'):
url = base_url + extract_text(eval_xpath_getindex(entry, './@href', 0)) # type: ignore
title = extract_text(eval_xpath_getindex(entry, '... | 66 | 333 | 368 | 701 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""pypi.org
"""
from urllib.parse import urlencode
from dateutil import parser
from lxml import html
from searx.utils import (
eval_xpath_getindex,
eval_xpath_list,
extract_text,
)
# about
about = {
"website": "https://pypi.org",
"wikidata_id": "Q2984... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""pypi.org
"""
from urllib.parse import urlencode
from dateutil import parser
from lxml import html
from searx.utils import (
eval_xpath_getindex,
eval_xpath_list,
extract_text,
)
# about
about = {
"website": "https://pypi.org",
"wikidata_id": "Q2984... | |
23,878 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/recoll.py | 79,80 | 1,144 | get_time_range | 80,90 | 80,90 | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- `Recoll <https://www.lesbonscomptes.com/recoll/>`_
- `recoll-webui <https://framagit.org/medoc92/recollwebui.git>`_
- :origin:`searx/engines/recoll.py`
Recoll_ is a desktop full-text search tool based on Xapian. By itself Recoll_
does not o... | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- `Recoll <https://www.lesbonscomptes.com/recoll/>`_
- `recoll-webui <https://framagit.org/medoc92/recollwebui.git>`_
- :origin:`searx/engines/recoll.py`
Recoll_ is a desktop full-text search tool based on Xapian. By itself Recoll_
does not o... | sw = {'day': 1, 'week': 7, 'month': 30, 'year': 365} # pylint: disable=invalid-name
offset = sw.get(time_range, 0)
if not offset:
return ''
return (date.today() - timedelta(days=offset)).isoformat()
# do search-request
| sw = {'day': 1, 'week': 7, 'month': 30, 'year': 365} # pylint: disable=invalid-name
offset = sw.get(time_range, 0)
if not offset:
return ''
return (date.today() - timedelta(days=offset)).isoformat()
# do search-request
| 29 | 1,194 | 108 | 1,302 | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- `Recoll <https://www.lesbonscomptes.com/recoll/>`_
- `recoll-webui <https://framagit.org/medoc92/recollwebui.git>`_
- :origin:`searx/engines/recoll.py`
Recoll_ is a desktop full-text search tool based on Xapian. By itself Recoll_
does not o... | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- `Recoll <https://www.lesbonscomptes.com/recoll/>`_
- `recoll-webui <https://framagit.org/medoc92/recollwebui.git>`_
- :origin:`searx/engines/recoll.py`
Recoll_ is a desktop full-text search tool based on Xapian. By itself Recoll_
does not o... | |
23,879 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/reddit.py | 37,38 | 1,77 | response | 38,77 | 38,77 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Reddit
"""
import json
from datetime import datetime
from urllib.parse import urlencode, urljoin, urlparse
# about
about = {
"website": 'https://www.reddit.com/',
"wikidata_id": 'Q1136',
"official_api_documentation": 'https://www.reddit.com/dev/api',
"u... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Reddit
"""
import json
from datetime import datetime
from urllib.parse import urlencode, urljoin, urlparse
# about
about = {
"website": 'https://www.reddit.com/',
"wikidata_id": 'Q1136',
"official_api_documentation": 'https://www.reddit.com/dev/api',
"u... |
img_results = []
text_results = []
search_results = json.loads(resp.text)
# return empty array if there are no results
if 'data' not in search_results:
return []
posts = search_results.get('data', {}).get('children', [])
# process results
for post in posts:
data = po... |
img_results = []
text_results = []
search_results = json.loads(resp.text)
# return empty array if there are no results
if 'data' not in search_results:
return []
posts = search_results.get('data', {}).get('children', [])
# process results
for post in posts:
data = po... | 127 | 286 | 396 | 682 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Reddit
"""
import json
from datetime import datetime
from urllib.parse import urlencode, urljoin, urlparse
# about
about = {
"website": 'https://www.reddit.com/',
"wikidata_id": 'Q1136',
"official_api_documentation": 'https://www.reddit.com/dev/api',
"u... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Reddit
"""
import json
from datetime import datetime
from urllib.parse import urlencode, urljoin, urlparse
# about
about = {
"website": 'https://www.reddit.com/',
"wikidata_id": 'Q1136',
"official_api_documentation": 'https://www.reddit.com/dev/api',
"u... | |
23,880 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/redis_server.py | 66,67 | 1,105 | search | 67,89 | 67,89 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Redis is an open source (BSD licensed), in-memory data structure (key value
based) store. Before configuring the ``redis_server`` engine, you must install
the dependency redis_.
Configuration
=============
Select a database to search in and set its index in the option ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Redis is an open source (BSD licensed), in-memory data structure (key value
based) store. Before configuring the ``redis_server`` engine, you must install
the dependency redis_.
Configuration
=============
Select a database to search in and set its index in the option ... | if not exact_match_only:
return search_keys(query)
ret = _redis_client.hgetall(query)
if ret:
ret['template'] = result_template
return [ret]
if ' ' in query:
qset, rest = query.split(' ', 1)
ret = []
for res in _redis_client.hscan_iter(qset, match='*{}*'... | if not exact_match_only:
return search_keys(query)
ret = _redis_client.hgetall(query)
if ret:
ret['template'] = result_template
return [ret]
if ' ' in query:
qset, rest = query.split(' ', 1)
ret = []
for res in _redis_client.hscan_iter(qset, match='*{}*'... | 46 | 611 | 183 | 794 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Redis is an open source (BSD licensed), in-memory data structure (key value
based) store. Before configuring the ``redis_server`` engine, you must install
the dependency redis_.
Configuration
=============
Select a database to search in and set its index in the option ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Redis is an open source (BSD licensed), in-memory data structure (key value
based) store. Before configuring the ``redis_server`` engine, you must install
the dependency redis_.
Configuration
=============
Select a database to search in and set its index in the option ... | |
23,881 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/rottentomatoes.py | 36,37 | 1,60 | response | 37,60 | 37,60 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""RottenTomatoes (movies)
"""
from urllib.parse import quote_plus
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
# about
about = {
"website": 'https://www.rottentomatoes.com/',
"wikidata_id": 'Q105584',
"official_api_do... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""RottenTomatoes (movies)
"""
from urllib.parse import quote_plus
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
# about
about = {
"website": 'https://www.rottentomatoes.com/',
"wikidata_id": 'Q105584',
"official_api_do... | results = []
dom = html.fromstring(resp.text)
for result in eval_xpath_list(dom, results_xpath):
content = []
for xpath in (release_year_xpath, score_xpath, cast_xpath):
info = extract_text(eval_xpath(result, xpath))
# a gap in the end means that no data was found
... | results = []
dom = html.fromstring(resp.text)
for result in eval_xpath_list(dom, results_xpath):
content = []
for xpath in (release_year_xpath, score_xpath, cast_xpath):
info = extract_text(eval_xpath(result, xpath))
# a gap in the end means that no data was found
... | 62 | 381 | 246 | 627 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""RottenTomatoes (movies)
"""
from urllib.parse import quote_plus
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
# about
about = {
"website": 'https://www.rottentomatoes.com/',
"wikidata_id": 'Q105584',
"official_api_do... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""RottenTomatoes (movies)
"""
from urllib.parse import quote_plus
from lxml import html
from searx.utils import eval_xpath, eval_xpath_list, extract_text
# about
about = {
"website": 'https://www.rottentomatoes.com/',
"wikidata_id": 'Q105584',
"official_api_do... | |
23,882 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/rumble.py | 49,50 | 1,87 | response | 50,87 | 50,87 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Rumble (Videos)
"""
from datetime import datetime
from urllib.parse import urlencode
from lxml import html
# about
from searx.utils import extract_text
about = {
"website": 'https://rumble.com/',
"wikidata_id": 'Q104765127',
"official_api_documentation": ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Rumble (Videos)
"""
from datetime import datetime
from urllib.parse import urlencode
from lxml import html
# about
from searx.utils import extract_text
about = {
"website": 'https://rumble.com/',
"wikidata_id": 'Q104765127',
"official_api_documentation": ... | results = []
dom = html.fromstring(resp.text)
results_dom = dom.xpath('//li[contains(@class, "video-listing-entry")]')
if not results_dom:
return []
for result_dom in results_dom:
url = base_url + extract_text(result_dom.xpath(url_xpath))
thumbnail = extract_text(result_dom... | results = []
dom = html.fromstring(resp.text)
results_dom = dom.xpath('//li[contains(@class, "video-listing-entry")]')
if not results_dom:
return []
for result_dom in results_dom:
url = base_url + extract_text(result_dom.xpath(url_xpath))
thumbnail = extract_text(result_dom... | 102 | 542 | 491 | 1,033 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Rumble (Videos)
"""
from datetime import datetime
from urllib.parse import urlencode
from lxml import html
# about
from searx.utils import extract_text
about = {
"website": 'https://rumble.com/',
"wikidata_id": 'Q104765127',
"official_api_documentation": ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Rumble (Videos)
"""
from datetime import datetime
from urllib.parse import urlencode
from lxml import html
# about
from searx.utils import extract_text
about = {
"website": 'https://rumble.com/',
"wikidata_id": 'Q104765127',
"official_api_documentation": ... | |
23,883 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/scanr_structures.py | 50,51 | 1,88 | response | 51,88 | 51,88 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
ScanR Structures (Science)
"""
from json import loads, dumps
from searx.utils import html_to_text
# about
about = {
"website": 'https://scanr.enseignementsup-recherche.gouv.fr',
"wikidata_id": 'Q44105684',
"official_api_documentation": 'https://scanr.ensei... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
ScanR Structures (Science)
"""
from json import loads, dumps
from searx.utils import html_to_text
# about
about = {
"website": 'https://scanr.enseignementsup-recherche.gouv.fr',
"wikidata_id": 'Q44105684',
"official_api_documentation": 'https://scanr.ensei... | results = []
search_res = loads(resp.text)
# return empty array if there are no results
if search_res.get('total', 0) < 1:
return []
# parse results
for result in search_res['results']:
if 'id' not in result:
continue
# is it thumbnail or img_src??
... | results = []
search_res = loads(resp.text)
# return empty array if there are no results
if search_res.get('total', 0) < 1:
return []
# parse results
for result in search_res['results']:
if 'id' not in result:
continue
# is it thumbnail or img_src??
... | 97 | 415 | 296 | 711 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
ScanR Structures (Science)
"""
from json import loads, dumps
from searx.utils import html_to_text
# about
about = {
"website": 'https://scanr.enseignementsup-recherche.gouv.fr',
"wikidata_id": 'Q44105684',
"official_api_documentation": 'https://scanr.ensei... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
ScanR Structures (Science)
"""
from json import loads, dumps
from searx.utils import html_to_text
# about
about = {
"website": 'https://scanr.enseignementsup-recherche.gouv.fr',
"wikidata_id": 'Q44105684',
"official_api_documentation": 'https://scanr.ensei... | |
23,884 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/searx_engine.py | 27,28 | 1,60 | request | 28,47 | 28,47 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Searx (all)
"""
from json import loads
from searx.engines import categories as searx_categories
# about
about = {
"website": 'https://github.com/searxng/searxng',
"wikidata_id": 'Q17639196',
"official_api_documentation": 'https://docs.searxng.org/dev/searc... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Searx (all)
"""
from json import loads
from searx.engines import categories as searx_categories
# about
about = {
"website": 'https://github.com/searxng/searxng',
"wikidata_id": 'Q17639196',
"official_api_documentation": 'https://docs.searxng.org/dev/searc... | global instance_index # pylint: disable=global-statement
params['url'] = instance_urls[instance_index % len(instance_urls)]
params['method'] = 'POST'
instance_index += 1
params['data'] = {
'q': query,
'pageno': params['pageno'],
'language': params['language'],
'tim... | global instance_index # pylint: disable=global-statement
params['url'] = instance_urls[instance_index % len(instance_urls)]
params['method'] = 'POST'
instance_index += 1
params['data'] = {
'q': query,
'pageno': params['pageno'],
'language': params['language'],
'tim... | 39 | 341 | 163 | 504 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Searx (all)
"""
from json import loads
from searx.engines import categories as searx_categories
# about
about = {
"website": 'https://github.com/searxng/searxng',
"wikidata_id": 'Q17639196',
"official_api_documentation": 'https://docs.searxng.org/dev/searc... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Searx (all)
"""
from json import loads
from searx.engines import categories as searx_categories
# about
about = {
"website": 'https://github.com/searxng/searxng',
"wikidata_id": 'Q17639196',
"official_api_documentation": 'https://docs.searxng.org/dev/searc... | |
23,885 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/seekr.py | 172,173 | 1,218 | _news_response | 173,207 | 173,207 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""seekr.com Seeker Score
Seekr is a privately held search and content evaluation engine that prioritizes
credibility over popularity.
Configuration
=============
The engine has the following additional settings:
- :py:obj:`seekr_category`
- :py:obj:`api_key`
This imple... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""seekr.com Seeker Score
Seekr is a privately held search and content evaluation engine that prioritizes
credibility over popularity.
Configuration
=============
The engine has the following additional settings:
- :py:obj:`seekr_category`
- :py:obj:`api_key`
This imple... |
search_results = json.get('expertResponses')
if search_results:
search_results = search_results[0]['advice']['categorySearchResult']['searchResult']
else: # response from a 'nextResultSet'
search_results = json.get('advice')
results = []
if not search_results:
return resul... |
search_results = json.get('expertResponses')
if search_results:
search_results = search_results[0]['advice']['categorySearchResult']['searchResult']
else: # response from a 'nextResultSet'
search_results = json.get('advice')
results = []
if not search_results:
return resul... | 72 | 1,473 | 333 | 1,806 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""seekr.com Seeker Score
Seekr is a privately held search and content evaluation engine that prioritizes
credibility over popularity.
Configuration
=============
The engine has the following additional settings:
- :py:obj:`seekr_category`
- :py:obj:`api_key`
This imple... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""seekr.com Seeker Score
Seekr is a privately held search and content evaluation engine that prioritizes
credibility over popularity.
Configuration
=============
The engine has the following additional settings:
- :py:obj:`seekr_category`
- :py:obj:`api_key`
This imple... | |
23,886 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/semantic_scholar.py | 25,26 | 1,103 | request | 26,45 | 26,45 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Semantic Scholar (Science)
"""
from json import dumps, loads
from datetime import datetime
from flask_babel import gettext
about = {
"website": 'https://www.semanticscholar.org/',
"wikidata_id": 'Q22908627',
"official_api_documentation": 'https://api.semant... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Semantic Scholar (Science)
"""
from json import dumps, loads
from datetime import datetime
from flask_babel import gettext
about = {
"website": 'https://www.semanticscholar.org/',
"wikidata_id": 'Q22908627',
"official_api_documentation": 'https://api.semant... | params['url'] = search_url
params['method'] = 'POST'
params['headers']['content-type'] = 'application/json'
params['data'] = dumps(
{
"queryString": query,
"page": params['pageno'],
"pageSize": 10,
"sort": "relevance",
"getQuerySuggesti... | params['url'] = search_url
params['method'] = 'POST'
params['headers']['content-type'] = 'application/json'
params['data'] = dumps(
{
"queryString": query,
"page": params['pageno'],
"pageSize": 10,
"sort": "relevance",
"getQuerySuggesti... | 35 | 838 | 161 | 999 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Semantic Scholar (Science)
"""
from json import dumps, loads
from datetime import datetime
from flask_babel import gettext
about = {
"website": 'https://www.semanticscholar.org/',
"wikidata_id": 'Q22908627',
"official_api_documentation": 'https://api.semant... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Semantic Scholar (Science)
"""
from json import dumps, loads
from datetime import datetime
from flask_babel import gettext
about = {
"website": 'https://www.semanticscholar.org/',
"wikidata_id": 'Q22908627',
"official_api_documentation": 'https://api.semant... | |
23,887 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/seznam.py | 49,50 | 1,74 | response | 50,74 | 50,74 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Seznam
"""
from urllib.parse import urlencode
from lxml import html
from searx.network import get
from searx.exceptions import SearxEngineAccessDeniedException
from searx.utils import (
extract_text,
eval_xpath_list,
eval_xpath_getindex,
)
# about
about = {... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Seznam
"""
from urllib.parse import urlencode
from lxml import html
from searx.network import get
from searx.exceptions import SearxEngineAccessDeniedException
from searx.utils import (
extract_text,
eval_xpath_list,
eval_xpath_getindex,
)
# about
about = {... | if resp.url.path.startswith('/verify'):
raise SearxEngineAccessDeniedException()
results = []
dom = html.fromstring(resp.content.decode())
for result_element in eval_xpath_list(
dom, '//div[@id="searchpage-root"]//div[@class="Layout--left"]/div[@class="f2c528"]'
):
result_d... | if resp.url.path.startswith('/verify'):
raise SearxEngineAccessDeniedException()
results = []
dom = html.fromstring(resp.content.decode())
for result_element in eval_xpath_list(
dom, '//div[@id="searchpage-root"]//div[@class="Layout--left"]/div[@class="f2c528"]'
):
result_d... | 50 | 440 | 301 | 741 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Seznam
"""
from urllib.parse import urlencode
from lxml import html
from searx.network import get
from searx.exceptions import SearxEngineAccessDeniedException
from searx.utils import (
extract_text,
eval_xpath_list,
eval_xpath_getindex,
)
# about
about = {... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Seznam
"""
from urllib.parse import urlencode
from lxml import html
from searx.network import get
from searx.exceptions import SearxEngineAccessDeniedException
from searx.utils import (
extract_text,
eval_xpath_list,
eval_xpath_getindex,
)
# about
about = {... | |
23,888 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/sjp.py | 39,40 | 1,99 | request | 40,45 | 40,45 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Słownik Języka Polskiego
Dictionary of the polish language from PWN (sjp.pwn)
"""
from lxml.html import fromstring
from searx import logger
from searx.utils import extract_text
from searx.network import raise_for_httperror
logger = logger.getChild('sjp engine')
# abou... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Słownik Języka Polskiego
Dictionary of the polish language from PWN (sjp.pwn)
"""
from lxml.html import fromstring
from searx import logger
from searx.utils import extract_text
from searx.network import raise_for_httperror
logger = logger.getChild('sjp engine')
# abou... | params['url'] = SEARCH_URL.format(query=query)
logger.debug(f"query_url --> {params['url']}")
return params
| params['url'] = SEARCH_URL.format(query=query)
logger.debug(f"query_url --> {params['url']}")
return params
| 8 | 1,028 | 49 | 1,077 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Słownik Języka Polskiego
Dictionary of the polish language from PWN (sjp.pwn)
"""
from lxml.html import fromstring
from searx import logger
from searx.utils import extract_text
from searx.network import raise_for_httperror
logger = logger.getChild('sjp engine')
# abou... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Słownik Języka Polskiego
Dictionary of the polish language from PWN (sjp.pwn)
"""
from lxml.html import fromstring
from searx import logger
from searx.utils import extract_text
from searx.network import raise_for_httperror
logger = logger.getChild('sjp engine')
# abou... | |
23,889 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/solidtorrents.py | 47,48 | 1,81 | response | 48,81 | 48,81 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""SolidTorrents
"""
from datetime import datetime
from urllib.parse import urlencode
import random
from lxml import html
from searx.utils import (
extract_text,
eval_xpath,
eval_xpath_getindex,
eval_xpath_list,
get_torrent_size,
)
about = {
"web... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""SolidTorrents
"""
from datetime import datetime
from urllib.parse import urlencode
import random
from lxml import html
from searx.utils import (
extract_text,
eval_xpath,
eval_xpath_getindex,
eval_xpath_list,
get_torrent_size,
)
about = {
"web... | results = []
dom = html.fromstring(resp.text)
for result in eval_xpath(dom, '//li[contains(@class, "search-result")]'):
torrentfile = eval_xpath_getindex(result, './/a[contains(@class, "dl-torrent")]/@href', 0, None)
magnet = eval_xpath_getindex(result, './/a[contains(@class, "dl-magnet")]/... | results = []
dom = html.fromstring(resp.text)
for result in eval_xpath(dom, '//li[contains(@class, "search-result")]'):
torrentfile = eval_xpath_getindex(result, './/a[contains(@class, "dl-torrent")]/@href', 0, None)
magnet = eval_xpath_getindex(result, './/a[contains(@class, "dl-magnet")]/... | 106 | 379 | 509 | 888 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""SolidTorrents
"""
from datetime import datetime
from urllib.parse import urlencode
import random
from lxml import html
from searx.utils import (
extract_text,
eval_xpath,
eval_xpath_getindex,
eval_xpath_list,
get_torrent_size,
)
about = {
"web... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""SolidTorrents
"""
from datetime import datetime
from urllib.parse import urlencode
import random
from lxml import html
from searx.utils import (
extract_text,
eval_xpath,
eval_xpath_getindex,
eval_xpath_list,
get_torrent_size,
)
about = {
"web... | |
23,890 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/solr.py | 75,76 | 1,99 | response | 76,89 | 76,89 | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- :origin:`solr.py <searx/engines/solr.py>`
- `Solr <https://solr.apache.org>`_
- `Solr Resources <https://solr.apache.org/resources.html>`_
- `Install Solr <https://solr.apache.org/guide/installing-solr.html>`_
Solr_ is a popular search en... | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- :origin:`solr.py <searx/engines/solr.py>`
- `Solr <https://solr.apache.org>`_
- `Solr Resources <https://solr.apache.org/resources.html>`_
- `Install Solr <https://solr.apache.org/guide/installing-solr.html>`_
Solr_ is a popular search en... | resp_json = __get_response(resp)
results = []
for result in resp_json['response']['docs']:
r = {key: str(value) for key, value in result.items()}
if len(r) == 0:
continue
r['template'] = 'key-value.html'
results.append(r)
return results
| resp_json = __get_response(resp)
results = []
for result in resp_json['response']['docs']:
r = {key: str(value) for key, value in result.items()}
if len(r) == 0:
continue
r['template'] = 'key-value.html'
results.append(r)
return results
| 30 | 721 | 109 | 830 | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- :origin:`solr.py <searx/engines/solr.py>`
- `Solr <https://solr.apache.org>`_
- `Solr Resources <https://solr.apache.org/resources.html>`_
- `Install Solr <https://solr.apache.org/guide/installing-solr.html>`_
Solr_ is a popular search en... | # SPDX-License-Identifier: AGPL-3.0-or-later
""".. sidebar:: info
- :origin:`solr.py <searx/engines/solr.py>`
- `Solr <https://solr.apache.org>`_
- `Solr Resources <https://solr.apache.org/resources.html>`_
- `Install Solr <https://solr.apache.org/guide/installing-solr.html>`_
Solr_ is a popular search en... | |
23,891 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/spotify.py | 54,55 | 1,78 | response | 55,78 | 55,78 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Spotify (Music)
"""
from json import loads
from urllib.parse import urlencode
import base64
from searx.network import post as http_post
# about
about = {
"website": 'https://www.spotify.com',
"wikidata_id": 'Q689141',
"official_api_documentation": 'https:/... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Spotify (Music)
"""
from json import loads
from urllib.parse import urlencode
import base64
from searx.network import post as http_post
# about
about = {
"website": 'https://www.spotify.com',
"wikidata_id": 'Q689141',
"official_api_documentation": 'https:/... | results = []
search_res = loads(resp.text)
# parse results
for result in search_res.get('tracks', {}).get('items', {}):
if result['type'] == 'track':
title = result['name']
link = result['external_urls']['spotify']
content = '{} - {} - {}'.format(result['art... | results = []
search_res = loads(resp.text)
# parse results
for result in search_res.get('tracks', {}).get('items', {}):
if result['type'] == 'track':
title = result['name']
link = result['external_urls']['spotify']
content = '{} - {} - {}'.format(result['art... | 56 | 480 | 221 | 701 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Spotify (Music)
"""
from json import loads
from urllib.parse import urlencode
import base64
from searx.network import post as http_post
# about
about = {
"website": 'https://www.spotify.com',
"wikidata_id": 'Q689141',
"official_api_documentation": 'https:/... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Spotify (Music)
"""
from json import loads
from urllib.parse import urlencode
import base64
from searx.network import post as http_post
# about
about = {
"website": 'https://www.spotify.com',
"wikidata_id": 'Q689141',
"official_api_documentation": 'https:/... | |
23,892 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/stackexchange.py | 49,50 | 1,71 | response | 50,71 | 50,71 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Stack Exchange API v2.3
* https://api.stackexchange.com/
"""
import html
from json import loads
from urllib.parse import urlencode
about = {
"website": 'https://stackexchange.com',
"wikidata_id": 'Q3495447',
"official_api_documentation": 'https://api.stack... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Stack Exchange API v2.3
* https://api.stackexchange.com/
"""
import html
from json import loads
from urllib.parse import urlencode
about = {
"website": 'https://stackexchange.com',
"wikidata_id": 'Q3495447',
"official_api_documentation": 'https://api.stack... |
results = []
json_data = loads(resp.text)
for result in json_data['items']:
content = "[%s]" % ", ".join(result['tags'])
content += " %s" % result['owner']['display_name']
if result['is_answered']:
content += ' // is answered'
content += " // score: %s" % resul... |
results = []
json_data = loads(resp.text)
for result in json_data['items']:
content = "[%s]" % ", ".join(result['tags'])
content += " %s" % result['owner']['display_name']
if result['is_answered']:
content += ' // is answered'
content += " // score: %s" % resul... | 53 | 368 | 203 | 571 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Stack Exchange API v2.3
* https://api.stackexchange.com/
"""
import html
from json import loads
from urllib.parse import urlencode
about = {
"website": 'https://stackexchange.com',
"wikidata_id": 'Q3495447',
"official_api_documentation": 'https://api.stack... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Stack Exchange API v2.3
* https://api.stackexchange.com/
"""
import html
from json import loads
from urllib.parse import urlencode
about = {
"website": 'https://stackexchange.com',
"wikidata_id": 'Q3495447',
"official_api_documentation": 'https://api.stack... | |
23,893 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/stract.py | 24,25 | 1,50 | request | 25,37 | 25,37 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Stract is an independent open source search engine. At this state, it's
still in beta and hence this implementation will need to be updated once beta
ends.
"""
from json import dumps
from searx.utils import searx_useragent
about = {
"website": "https://stract.com/... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Stract is an independent open source search engine. At this state, it's
still in beta and hence this implementation will need to be updated once beta
ends.
"""
from json import dumps
from searx.utils import searx_useragent
about = {
"website": "https://stract.com/... | params['url'] = search_url
params['method'] = "POST"
params['headers'] = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'User-Agent': searx_useragent(),
}
params['data'] = dumps({'query': query, 'page': params['pageno'] - 1})
return params
| params['url'] = search_url
params['method'] = "POST"
params['headers'] = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'User-Agent': searx_useragent(),
}
params['data'] = dumps({'query': query, 'page': params['pageno'] - 1})
return params
| 26 | 307 | 114 | 421 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Stract is an independent open source search engine. At this state, it's
still in beta and hence this implementation will need to be updated once beta
ends.
"""
from json import dumps
from searx.utils import searx_useragent
about = {
"website": "https://stract.com/... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Stract is an independent open source search engine. At this state, it's
still in beta and hence this implementation will need to be updated once beta
ends.
"""
from json import dumps
from searx.utils import searx_useragent
about = {
"website": "https://stract.com/... | |
23,894 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/svgrepo.py | 31,32 | 1,46 | response | 32,46 | 32,46 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Svgrepo (images)
"""
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
"website": 'https://www.svgrepo.com',
"official_api_documentation": 'https://svgapi.com',
"use_official_api": False,
"require_api_key":... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Svgrepo (images)
"""
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
"website": 'https://www.svgrepo.com',
"official_api_documentation": 'https://svgapi.com',
"use_official_api": False,
"require_api_key":... | results = []
dom = html.fromstring(resp.text)
for result in eval_xpath_list(dom, results_xpath):
results.append(
{
'template': 'images.html',
'url': base_url + extract_text(eval_xpath(result, url_xpath)),
'title': extract_text(eval_xpath(r... | results = []
dom = html.fromstring(resp.text)
for result in eval_xpath_list(dom, results_xpath):
results.append(
{
'template': 'images.html',
'url': base_url + extract_text(eval_xpath(result, url_xpath)),
'title': extract_text(eval_xpath(r... | 35 | 296 | 168 | 464 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Svgrepo (images)
"""
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
"website": 'https://www.svgrepo.com',
"official_api_documentation": 'https://svgapi.com',
"use_official_api": False,
"require_api_key":... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Svgrepo (images)
"""
from lxml import html
from searx.utils import extract_text, eval_xpath, eval_xpath_list
about = {
"website": 'https://www.svgrepo.com',
"official_api_documentation": 'https://svgapi.com',
"use_official_api": False,
"require_api_key":... | |
23,895 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/tokyotoshokan.py | 40,41 | 1,99 | response | 41,99 | 41,99 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Tokyo Toshokan (A BitTorrent Library for Japanese Media)
"""
import re
from datetime import datetime
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, get_torrent_size, int_or_zero
# about
about = {
"website": 'https://... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Tokyo Toshokan (A BitTorrent Library for Japanese Media)
"""
import re
from datetime import datetime
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, get_torrent_size, int_or_zero
# about
about = {
"website": 'https://... | results = []
dom = html.fromstring(resp.text)
rows = dom.xpath('//table[@class="listing"]//tr[contains(@class, "category_0")]')
# check if there are no results or page layout was changed so we cannot parse it
# currently there are two rows for each result, so total count must be even
if len(ro... | results = []
dom = html.fromstring(resp.text)
rows = dom.xpath('//table[@class="listing"]//tr[contains(@class, "category_0")]')
# check if there are no results or page layout was changed so we cannot parse it
# currently there are two rows for each result, so total count must be even
if len(ro... | 247 | 319 | 818 | 1,137 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Tokyo Toshokan (A BitTorrent Library for Japanese Media)
"""
import re
from datetime import datetime
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, get_torrent_size, int_or_zero
# about
about = {
"website": 'https://... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Tokyo Toshokan (A BitTorrent Library for Japanese Media)
"""
import re
from datetime import datetime
from urllib.parse import urlencode
from lxml import html
from searx.utils import extract_text, get_torrent_size, int_or_zero
# about
about = {
"website": 'https://... | |
23,896 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/tootfinder.py | 26,27 | 1,60 | response | 27,60 | 27,60 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Tootfinder (social media)
"""
from datetime import datetime
from json import loads
from searx.utils import html_to_text
about = {
'website': "https://www.tootfinder.ch",
'official_api_documentation': "https://wiki.tootfinder.ch/index.php?name=the-tootfinder-rest... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Tootfinder (social media)
"""
from datetime import datetime
from json import loads
from searx.utils import html_to_text
about = {
'website': "https://www.tootfinder.ch",
'official_api_documentation': "https://wiki.tootfinder.ch/index.php?name=the-tootfinder-rest... | results = []
# the API of tootfinder has an issue that errors on server side are appended to the API response as HTML
# thus we're only looking for the line that contains the actual json data and ignore everything else
json_str = ""
for line in resp.text.split("\n"):
if line.startswith("[{"... | results = []
# the API of tootfinder has an issue that errors on server side are appended to the API response as HTML
# thus we're only looking for the line that contains the actual json data and ignore everything else
json_str = ""
for line in resp.text.split("\n"):
if line.startswith("[{"... | 112 | 232 | 352 | 584 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Tootfinder (social media)
"""
from datetime import datetime
from json import loads
from searx.utils import html_to_text
about = {
'website': "https://www.tootfinder.ch",
'official_api_documentation': "https://wiki.tootfinder.ch/index.php?name=the-tootfinder-rest... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Tootfinder (social media)
"""
from datetime import datetime
from json import loads
from searx.utils import html_to_text
about = {
'website': "https://www.tootfinder.ch",
'official_api_documentation': "https://wiki.tootfinder.ch/index.php?name=the-tootfinder-rest... | |
23,897 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/translated.py | 26,27 | 1,53 | request | 27,37 | 27,37 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MyMemory Translated
"""
# about
about = {
"website": 'https://mymemory.translated.net/',
"wikidata_id": None,
"official_api_documentation": 'https://mymemory.translated.net/doc/spec.php',
"use_official_api": True,
"require_api_key": False,
"resul... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MyMemory Translated
"""
# about
about = {
"website": 'https://mymemory.translated.net/',
"wikidata_id": None,
"official_api_documentation": 'https://mymemory.translated.net/doc/spec.php',
"use_official_api": True,
"require_api_key": False,
"resul... | if api_key:
key_form = '&key=' + api_key
else:
key_form = ''
params['url'] = url.format(
from_lang=params['from_lang'][1], to_lang=params['to_lang'][1], query=params['query'], key=key_form
)
return params
| if api_key:
key_form = '&key=' + api_key
else:
key_form = ''
params['url'] = url.format(
from_lang=params['from_lang'][1], to_lang=params['to_lang'][1], query=params['query'], key=key_form
)
return params
| 21 | 447 | 102 | 549 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MyMemory Translated
"""
# about
about = {
"website": 'https://mymemory.translated.net/',
"wikidata_id": None,
"official_api_documentation": 'https://mymemory.translated.net/doc/spec.php',
"use_official_api": True,
"require_api_key": False,
"resul... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""MyMemory Translated
"""
# about
about = {
"website": 'https://mymemory.translated.net/',
"wikidata_id": None,
"official_api_documentation": 'https://mymemory.translated.net/doc/spec.php',
"use_official_api": True,
"require_api_key": False,
"resul... | |
23,898 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/vimeo.py | 37,38 | 1,67 | response | 38,67 | 38,67 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Wikipedia (Web
"""
from urllib.parse import urlencode
from json import loads
from dateutil import parser
# about
about = {
"website": 'https://vimeo.com/',
"wikidata_id": 'Q156376',
"official_api_documentation": 'http://developer.vimeo.com/api',
"use_o... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Wikipedia (Web
"""
from urllib.parse import urlencode
from json import loads
from dateutil import parser
# about
about = {
"website": 'https://vimeo.com/',
"wikidata_id": 'Q156376',
"official_api_documentation": 'http://developer.vimeo.com/api',
"use_o... | 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])
# parse results
for result in data['filtered']['data']:
result = result[result['type']]
videoid = result['uri... | 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])
# parse results
for result in data['filtered']['data']:
result = result[result['type']]
videoid = result['uri... | 70 | 294 | 305 | 599 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Wikipedia (Web
"""
from urllib.parse import urlencode
from json import loads
from dateutil import parser
# about
about = {
"website": 'https://vimeo.com/',
"wikidata_id": 'Q156376',
"official_api_documentation": 'http://developer.vimeo.com/api',
"use_o... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Wikipedia (Web
"""
from urllib.parse import urlencode
from json import loads
from dateutil import parser
# about
about = {
"website": 'https://vimeo.com/',
"wikidata_id": 'Q156376',
"official_api_documentation": 'http://developer.vimeo.com/api',
"use_o... | |
23,899 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/voidlinux.py | 38,39 | 1,91 | request | 39,50 | 39,50 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""SearXNG engine for `Void Linux binary packages`_. Void is a general purpose
operating system, based on the monolithic Linux kernel. Its package system
allows you to quickly install, update and remove software; software is provided
in binary packages or can be built direc... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""SearXNG engine for `Void Linux binary packages`_. Void is a general purpose
operating system, based on the monolithic Linux kernel. Its package system
allows you to quickly install, update and remove software; software is provided
in binary packages or can be built direc... | arch_path = ARCH_RE.search(query)
if arch_path:
arch_path = arch_path.group(0)
query = query.replace(arch_path, '').strip()
else:
arch_path = void_arch
params['url'] = f"{base_url}/v1/query/{arch_path}?q={quote_plus(query)}"
return params
| arch_path = ARCH_RE.search(query)
if arch_path:
arch_path = arch_path.group(0)
query = query.replace(arch_path, '').strip()
else:
arch_path = void_arch
params['url'] = f"{base_url}/v1/query/{arch_path}?q={quote_plus(query)}"
return params
| 21 | 881 | 117 | 998 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""SearXNG engine for `Void Linux binary packages`_. Void is a general purpose
operating system, based on the monolithic Linux kernel. Its package system
allows you to quickly install, update and remove software; software is provided
in binary packages or can be built direc... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""SearXNG engine for `Void Linux binary packages`_. Void is a general purpose
operating system, based on the monolithic Linux kernel. Its package system
allows you to quickly install, update and remove software; software is provided
in binary packages or can be built direc... | |
23,900 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/wallhaven.py | 66,67 | 1,89 | response | 67,89 | 67,89 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wallhaven_ is a site created by and for people who like wallpapers.
.. _Wallhaven: https://wallhaven.cc/about#Copyright
"""
from datetime import datetime
from urllib.parse import urlencode
from searx.utils import humanize_bytes
about = {
'website': 'https://wallha... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wallhaven_ is a site created by and for people who like wallpapers.
.. _Wallhaven: https://wallhaven.cc/about#Copyright
"""
from datetime import datetime
from urllib.parse import urlencode
from searx.utils import humanize_bytes
about = {
'website': 'https://wallha... | results = []
json = resp.json()
for result in json['data']:
results.append(
{
'template': 'images.html',
'title': '',
'content': f"{result['category']} / {result['purity']}",
'url': result['url'],
'img_src... | results = []
json = resp.json()
for result in json['data']:
results.append(
{
'template': 'images.html',
'title': '',
'content': f"{result['category']} / {result['purity']}",
'url': result['url'],
'img_src... | 43 | 632 | 225 | 857 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wallhaven_ is a site created by and for people who like wallpapers.
.. _Wallhaven: https://wallhaven.cc/about#Copyright
"""
from datetime import datetime
from urllib.parse import urlencode
from searx.utils import humanize_bytes
about = {
'website': 'https://wallha... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wallhaven_ is a site created by and for people who like wallpapers.
.. _Wallhaven: https://wallhaven.cc/about#Copyright
"""
from datetime import datetime
from urllib.parse import urlencode
from searx.utils import humanize_bytes
about = {
'website': 'https://wallha... | |
23,901 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/wikicommons.py | 65,66 | 1,103 | response | 66,103 | 66,103 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wikimedia Commons (images)
"""
import datetime
from urllib.parse import urlencode
# about
about = {
"website": 'https://commons.wikimedia.org/',
"wikidata_id": 'Q565',
"official_api_documentation": 'https://commons.wikimedia.org/w/api.php',
"use_offici... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wikimedia Commons (images)
"""
import datetime
from urllib.parse import urlencode
# about
about = {
"website": 'https://commons.wikimedia.org/',
"wikidata_id": 'Q565',
"official_api_documentation": 'https://commons.wikimedia.org/w/api.php',
"use_offici... | results = []
json = resp.json()
if not json.get("query", {}).get("pages"):
return results
for item in json["query"]["pages"].values():
imageinfo = item["imageinfo"][0]
title = item["title"].replace("File:", "").rsplit('.', 1)[0]
result = {
'url': imageinfo["d... | results = []
json = resp.json()
if not json.get("query", {}).get("pages"):
return results
for item in json["query"]["pages"].values():
imageinfo = item["imageinfo"][0]
title = item["title"].replace("File:", "").rsplit('.', 1)[0]
result = {
'url': imageinfo["d... | 94 | 575 | 415 | 990 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wikimedia Commons (images)
"""
import datetime
from urllib.parse import urlencode
# about
about = {
"website": 'https://commons.wikimedia.org/',
"wikidata_id": 'Q565',
"official_api_documentation": 'https://commons.wikimedia.org/w/api.php',
"use_offici... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wikimedia Commons (images)
"""
import datetime
from urllib.parse import urlencode
# about
about = {
"website": 'https://commons.wikimedia.org/',
"wikidata_id": 'Q565',
"official_api_documentation": 'https://commons.wikimedia.org/w/api.php',
"use_offici... | |
23,902 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/wolframalpha_api.py | 52,53 | 1,142 | replace_pua_chars | 53,72 | 53,72 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wolfram|Alpha (Science)
"""
from urllib.parse import urlencode
from lxml import etree
# about
about = {
"website": 'https://www.wolframalpha.com',
"wikidata_id": 'Q207006',
"official_api_documentation": 'https://products.wolframalpha.com/api/',
"use_of... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wolfram|Alpha (Science)
"""
from urllib.parse import urlencode
from lxml import etree
# about
about = {
"website": 'https://www.wolframalpha.com',
"wikidata_id": 'Q207006',
"official_api_documentation": 'https://products.wolframalpha.com/api/',
"use_of... | pua_chars = {
'\uf522': '\u2192', # right arrow
'\uf7b1': '\u2115', # set of natural numbers
'\uf7b4': '\u211a', # set of rational numbers
'\uf7b5': '\u211d', # set of real numbers
'\uf7bd': '\u2124', # set of integer numbers
'\uf74c': 'd', # differential
... | pua_chars = {
'\uf522': '\u2192', # right arrow
'\uf7b1': '\u2115', # set of natural numbers
'\uf7b4': '\u211a', # set of rational numbers
'\uf7b5': '\u211d', # set of real numbers
'\uf7bd': '\u2124', # set of integer numbers
'\uf74c': 'd', # differential
... | 72 | 1,237 | 242 | 1,479 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wolfram|Alpha (Science)
"""
from urllib.parse import urlencode
from lxml import etree
# about
about = {
"website": 'https://www.wolframalpha.com',
"wikidata_id": 'Q207006',
"official_api_documentation": 'https://products.wolframalpha.com/api/',
"use_of... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wolfram|Alpha (Science)
"""
from urllib.parse import urlencode
from lxml import etree
# about
about = {
"website": 'https://www.wolframalpha.com',
"wikidata_id": 'Q207006',
"official_api_documentation": 'https://products.wolframalpha.com/api/',
"use_of... | |
23,903 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/wolframalpha_noapi.py | 78,79 | 1,134 | response | 79,134 | 79,134 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Wolfram|Alpha (Science)
"""
from json import loads
from time import time
from urllib.parse import urlencode
from searx.network import get as http_get
# about
about = {
"website": 'https://www.wolframalpha.com/',
"wikidata_id": 'Q207006',
"official_api_doc... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Wolfram|Alpha (Science)
"""
from json import loads
from time import time
from urllib.parse import urlencode
from searx.network import get as http_get
# about
about = {
"website": 'https://www.wolframalpha.com/',
"wikidata_id": 'Q207006',
"official_api_doc... | results = []
resp_json = loads(resp.text)
if not resp_json['queryresult']['success']:
return []
# handle resp_json['queryresult']['assumptions']?
result_chunks = []
infobox_title = ""
result_content = ""
for pod in resp_json['queryresult']['pods']:
pod_id = pod.get('id... | results = []
resp_json = loads(resp.text)
if not resp_json['queryresult']['success']:
return []
# handle resp_json['queryresult']['assumptions']?
result_chunks = []
infobox_title = ""
result_content = ""
for pod in resp_json['queryresult']['pods']:
pod_id = pod.get('id... | 145 | 770 | 578 | 1,348 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Wolfram|Alpha (Science)
"""
from json import loads
from time import time
from urllib.parse import urlencode
from searx.network import get as http_get
# about
about = {
"website": 'https://www.wolframalpha.com/',
"wikidata_id": 'Q207006',
"official_api_doc... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Wolfram|Alpha (Science)
"""
from json import loads
from time import time
from urllib.parse import urlencode
from searx.network import get as http_get
# about
about = {
"website": 'https://www.wolframalpha.com/',
"wikidata_id": 'Q207006',
"official_api_doc... | |
23,904 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/wttr.py | 89,90 | 1,136 | response | 90,136 | 90,136 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""wttr.in (weather forecast service)"""
from json import loads
from urllib.parse import quote
from flask_babel import gettext
about = {
"website": "https://wttr.in",
"wikidata_id": "Q107586666",
"official_api_documentation": "https://github.com/chubin/wttr.in#... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""wttr.in (weather forecast service)"""
from json import loads
from urllib.parse import quote
from flask_babel import gettext
about = {
"website": "https://wttr.in",
"wikidata_id": "Q107586666",
"official_api_documentation": "https://github.com/chubin/wttr.in#... | results = []
if resp.status_code == 404:
return []
result = loads(resp.text)
current = result["current_condition"][0]
location = result['nearest_area'][0]
forecast_indices = {3: gettext('Morning'), 4: gettext('Noon'), 6: gettext('Evening'), 7: gettext('Night')}
title = f"{locati... | results = []
if resp.status_code == 404:
return []
result = loads(resp.text)
current = result["current_condition"][0]
location = result['nearest_area'][0]
forecast_indices = {3: gettext('Morning'), 4: gettext('Noon'), 6: gettext('Evening'), 7: gettext('Night')}
title = f"{locati... | 88 | 1,156 | 488 | 1,644 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""wttr.in (weather forecast service)"""
from json import loads
from urllib.parse import quote
from flask_babel import gettext
about = {
"website": "https://wttr.in",
"wikidata_id": "Q107586666",
"official_api_documentation": "https://github.com/chubin/wttr.in#... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""wttr.in (weather forecast service)"""
from json import loads
from urllib.parse import quote
from flask_babel import gettext
about = {
"website": "https://wttr.in",
"wikidata_id": "Q107586666",
"official_api_documentation": "https://github.com/chubin/wttr.in#... | |
23,905 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/www1x.py | 39,40 | 1,64 | response | 40,64 | 40,64 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""1x (Images)
"""
from urllib.parse import urlencode, urljoin
from lxml import html, etree
from searx.utils import extract_text, eval_xpath_list, eval_xpath_getindex
# about
about = {
"website": 'https://1x.com/',
"wikidata_id": None,
"official_api_documenta... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""1x (Images)
"""
from urllib.parse import urlencode, urljoin
from lxml import html, etree
from searx.utils import extract_text, eval_xpath_list, eval_xpath_getindex
# about
about = {
"website": 'https://1x.com/',
"wikidata_id": None,
"official_api_documenta... | results = []
xmldom = etree.fromstring(resp.content)
xmlsearchresult = eval_xpath_getindex(xmldom, '//data', 0)
dom = html.fragment_fromstring(xmlsearchresult.text, create_parent='div')
for link in eval_xpath_list(dom, '//a'):
url = urljoin(base_url, link.attrib.get('href'))
title = ... | results = []
xmldom = etree.fromstring(resp.content)
xmlsearchresult = eval_xpath_getindex(xmldom, '//data', 0)
dom = html.fragment_fromstring(xmlsearchresult.text, create_parent='div')
for link in eval_xpath_list(dom, '//a'):
url = urljoin(base_url, link.attrib.get('href'))
title = ... | 60 | 308 | 283 | 591 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""1x (Images)
"""
from urllib.parse import urlencode, urljoin
from lxml import html, etree
from searx.utils import extract_text, eval_xpath_list, eval_xpath_getindex
# about
about = {
"website": 'https://1x.com/',
"wikidata_id": None,
"official_api_documenta... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""1x (Images)
"""
from urllib.parse import urlencode, urljoin
from lxml import html, etree
from searx.utils import extract_text, eval_xpath_list, eval_xpath_getindex
# about
about = {
"website": 'https://1x.com/',
"wikidata_id": None,
"official_api_documenta... | |
23,906 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/yacy.py | 101,102 | 1,187 | init | 102,111 | 102,111 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""YaCy_ is a free distributed search engine, built on the principles of
peer-to-peer (P2P) networks.
API: Dev:APIyacysearch_
Releases:
- https://github.com/yacy/yacy_search_server/tags
- https://download.yacy.net/
.. _Yacy: https://yacy.net/
.. _Dev:APIyacysearch: https... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""YaCy_ is a free distributed search engine, built on the principles of
peer-to-peer (P2P) networks.
API: Dev:APIyacysearch_
Releases:
- https://github.com/yacy/yacy_search_server/tags
- https://download.yacy.net/
.. _Yacy: https://yacy.net/
.. _Dev:APIyacysearch: https... | valid_types = [
'text',
'image',
# 'app', 'audio', 'video',
]
if search_type not in valid_types:
raise ValueError('search_type "%s" is not one of %s' % (search_type, valid_types))
| valid_types = [
'text',
'image',
# 'app', 'audio', 'video',
]
if search_type not in valid_types:
raise ValueError('search_type "%s" is not one of %s' % (search_type, valid_types))
| 26 | 1,373 | 85 | 1,458 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""YaCy_ is a free distributed search engine, built on the principles of
peer-to-peer (P2P) networks.
API: Dev:APIyacysearch_
Releases:
- https://github.com/yacy/yacy_search_server/tags
- https://download.yacy.net/
.. _Yacy: https://yacy.net/
.. _Dev:APIyacysearch: https... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""YaCy_ is a free distributed search engine, built on the principles of
peer-to-peer (P2P) networks.
API: Dev:APIyacysearch_
Releases:
- https://github.com/yacy/yacy_search_server/tags
- https://download.yacy.net/
.. _Yacy: https://yacy.net/
.. _Dev:APIyacysearch: https... | |
23,907 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/yandex_music.py | 43,44 | 1,64 | response | 44,64 | 44,64 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yandex Music
.. _Countries where Yandex.Music is available: https://yandex.com/support/music/access.html
.. hint::
Access to music is limited to a few countries: `Countries where Yandex.Music
is available`_
"""
from urllib.parse import urlencode
# about
about ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yandex Music
.. _Countries where Yandex.Music is available: https://yandex.com/support/music/access.html
.. hint::
Access to music is limited to a few countries: `Countries where Yandex.Music
is available`_
"""
from urllib.parse import urlencode
# about
about ... | results = []
search_res = resp.json()
# parse results
for result in search_res.get('tracks', {}).get('items', []):
if result['type'] == 'music':
track_id = result['id']
album_id = result['albums'][0]['id']
# append result
results.append(
... | results = []
search_res = resp.json()
# parse results
for result in search_res.get('tracks', {}).get('items', []):
if result['type'] == 'music':
track_id = result['id']
album_id = result['albums'][0]['id']
# append result
results.append(
... | 45 | 343 | 235 | 578 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yandex Music
.. _Countries where Yandex.Music is available: https://yandex.com/support/music/access.html
.. hint::
Access to music is limited to a few countries: `Countries where Yandex.Music
is available`_
"""
from urllib.parse import urlencode
# about
about ... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yandex Music
.. _Countries where Yandex.Music is available: https://yandex.com/support/music/access.html
.. hint::
Access to music is limited to a few countries: `Countries where Yandex.Music
is available`_
"""
from urllib.parse import urlencode
# about
about ... | |
23,908 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/yep.py | 45,46 | 1,79 | _images_result | 46,56 | 46,56 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yep (general, images, news)
"""
from datetime import datetime
from urllib.parse import urlencode
from searx.utils import html_to_text
about = {
'website': 'https://yep.com/',
'official_api_documentation': 'https://docs.developer.yelp.com',
'use_official_api'... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yep (general, images, news)
"""
from datetime import datetime
from urllib.parse import urlencode
from searx.utils import html_to_text
about = {
'website': 'https://yep.com/',
'official_api_documentation': 'https://docs.developer.yelp.com',
'use_official_api'... | return {
'template': 'images.html',
'url': result['host_page'],
'title': result.get('title', ''),
'content': '',
'img_src': result['image_id'],
'thumbnail_src': result['src'],
}
| return {
'template': 'images.html',
'url': result['host_page'],
'title': result.get('title', ''),
'content': '',
'img_src': result['image_id'],
'thumbnail_src': result['src'],
}
| 16 | 626 | 84 | 710 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yep (general, images, news)
"""
from datetime import datetime
from urllib.parse import urlencode
from searx.utils import html_to_text
about = {
'website': 'https://yep.com/',
'official_api_documentation': 'https://docs.developer.yelp.com',
'use_official_api'... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yep (general, images, news)
"""
from datetime import datetime
from urllib.parse import urlencode
from searx.utils import html_to_text
about = {
'website': 'https://yep.com/',
'official_api_documentation': 'https://docs.developer.yelp.com',
'use_official_api'... | |
23,909 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/youtube_api.py | 45,46 | 1,93 | response | 46,93 | 46,93 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Youtube (Videos)
"""
from json import loads
from urllib.parse import urlencode
from dateutil import parser
from searx.exceptions import SearxEngineAPIException
# about
about = {
"website": 'https://www.youtube.com/',
"wikidata_id": 'Q866',
"official_api_d... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Youtube (Videos)
"""
from json import loads
from urllib.parse import urlencode
from dateutil import parser
from searx.exceptions import SearxEngineAPIException
# about
about = {
"website": 'https://www.youtube.com/',
"wikidata_id": 'Q866',
"official_api_d... | results = []
search_results = loads(resp.text)
if 'error' in search_results and 'message' in search_results['error']:
raise SearxEngineAPIException(search_results['error']['message'])
# return empty array if there are no results
if 'items' not in search_results:
return []
# p... | results = []
search_results = loads(resp.text)
if 'error' in search_results and 'message' in search_results['error']:
raise SearxEngineAPIException(search_results['error']['message'])
# return empty array if there are no results
if 'items' not in search_results:
return []
# p... | 105 | 419 | 398 | 817 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Youtube (Videos)
"""
from json import loads
from urllib.parse import urlencode
from dateutil import parser
from searx.exceptions import SearxEngineAPIException
# about
about = {
"website": 'https://www.youtube.com/',
"wikidata_id": 'Q866',
"official_api_d... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Youtube (Videos)
"""
from json import loads
from urllib.parse import urlencode
from dateutil import parser
from searx.exceptions import SearxEngineAPIException
# about
about = {
"website": 'https://www.youtube.com/',
"wikidata_id": 'Q866',
"official_api_d... | |
23,910 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/youtube_noapi.py | 38,39 | 1,171 | request | 39,59 | 39,59 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Youtube (Videos)
"""
from functools import reduce
from json import loads, dumps
from urllib.parse import quote_plus
# about
about = {
"website": 'https://www.youtube.com/',
"wikidata_id": 'Q866',
"official_api_documentation": 'https://developers.google.com/... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Youtube (Videos)
"""
from functools import reduce
from json import loads, dumps
from urllib.parse import quote_plus
# about
about = {
"website": 'https://www.youtube.com/',
"wikidata_id": 'Q866',
"official_api_documentation": 'https://developers.google.com/... | params['cookies']['CONSENT'] = "YES+"
if not params['engine_data'].get('next_page_token'):
params['url'] = search_url.format(query=quote_plus(query), page=params['pageno'])
if params['time_range'] in time_range_dict:
params['url'] += time_range_url.format(time_range=time_range_dict[p... | params['cookies']['CONSENT'] = "YES+"
if not params['engine_data'].get('next_page_token'):
params['url'] = search_url.format(query=quote_plus(query), page=params['pageno'])
if params['time_range'] in time_range_dict:
params['url'] += time_range_url.format(time_range=time_range_dict[p... | 48 | 1,588 | 266 | 1,854 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Youtube (Videos)
"""
from functools import reduce
from json import loads, dumps
from urllib.parse import quote_plus
# about
about = {
"website": 'https://www.youtube.com/',
"wikidata_id": 'Q866',
"official_api_documentation": 'https://developers.google.com/... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Youtube (Videos)
"""
from functools import reduce
from json import loads, dumps
from urllib.parse import quote_plus
# about
about = {
"website": 'https://www.youtube.com/',
"wikidata_id": 'Q866',
"official_api_documentation": 'https://developers.google.com/... | |
23,911 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/engines/yummly.py | 28,29 | 1,79 | request | 29,40 | 29,40 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yummly
"""
from urllib.parse import urlencode
from flask_babel import gettext
from searx.utils import markdown_to_text
about = {
"website": 'https://yummly.com',
"wikidata_id": 'Q8061140',
# not used since it requires an api key
"official_api_documentat... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yummly
"""
from urllib.parse import urlencode
from flask_babel import gettext
from searx.utils import markdown_to_text
about = {
"website": 'https://yummly.com',
"wikidata_id": 'Q8061140',
# not used since it requires an api key
"official_api_documentat... | args = {
'q': query,
'start': (params['pageno'] - 1) * number_of_results,
'maxResult': number_of_results,
}
params['url'] = f"{api_url}/mapi/v23/content/search?{urlencode(args)}&allowedContent=single_recipe"
return params
| args = {
'q': query,
'start': (params['pageno'] - 1) * number_of_results,
'maxResult': number_of_results,
}
params['url'] = f"{api_url}/mapi/v23/content/search?{urlencode(args)}&allowedContent=single_recipe"
return params
| 19 | 611 | 109 | 720 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yummly
"""
from urllib.parse import urlencode
from flask_babel import gettext
from searx.utils import markdown_to_text
about = {
"website": 'https://yummly.com',
"wikidata_id": 'Q8061140',
# not used since it requires an api key
"official_api_documentat... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Yummly
"""
from urllib.parse import urlencode
from flask_babel import gettext
from searx.utils import markdown_to_text
about = {
"website": 'https://yummly.com',
"wikidata_id": 'Q8061140',
# not used since it requires an api key
"official_api_documentat... | |
23,912 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/exceptions.py | 78,79 | 57,84 | _get_default_suspended_time | SearxEngineAccessDeniedException | 79,84 | 79,84 | class SearxEngineAccessDeniedException(SearxEngineResponseException):
"""The website is blocking the access"""
SUSPEND_TIME_SETTING = "search.suspended_times.SearxEngineAccessDenied"
"""This settings contains the default suspended time (default 86400 sec / 1
day)."""
def __init__(self, suspended_t... | class SearxEngineAccessDeniedException(SearxEngineResponseException):
"""The website is blocking the access"""
SUSPEND_TIME_SETTING = "search.suspended_times.SearxEngineAccessDenied"
"""This settings contains the default suspended time (default 86400 sec / 1
day)."""
def __init__(self, suspended_t... | from searx import get_setting # pylint: disable=C0415
return get_setting(self.SUSPEND_TIME_SETTING)
| from searx import get_setting # pylint: disable=C0415
return get_setting(self.SUSPEND_TIME_SETTING)
| 9 | 288 | 51 | 339 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Exception types raised by SearXNG modules.
"""
from typing import Optional, Union
class SearxException(Exception):
"""Base SearXNG exception."""
class SearxParameterException(SearxException):
"""Raised when query miss a required parameter"""
def __init__... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Exception types raised by SearXNG modules.
"""
from typing import Optional, Union
class SearxException(Exception):
"""Base SearXNG exception."""
class SearxParameterException(SearxException):
"""Raised when query miss a required parameter"""
def __init__... |
23,913 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/external_urls.py | 66,67 | 1,94 | area_to_osm_zoom | 89,94 | 67,94 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import math
from searx.data import EXTERNAL_URLS
IMDB_PREFIX_TO_URL_ID = {
'tt': 'imdb_title',
'mn': 'imdb_name',
'ch': 'imdb_character',
'co': 'imdb_company',
'ev': 'imdb_event',
}
HTTP_WIKIMEDIA_IMAGE = 'ht... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import math
from searx.data import EXTERNAL_URLS
IMDB_PREFIX_TO_URL_ID = {
'tt': 'imdb_title',
'mn': 'imdb_name',
'ch': 'imdb_character',
'co': 'imdb_company',
'ev': 'imdb_event',
}
HTTP_WIKIMEDIA_IMAGE = 'ht... | try:
amount = float(area)
return max(0, min(19, round(19 - 0.688297 * math.log(226.878 * amount))))
except ValueError:
return 19
| """Convert an area in km² into an OSM zoom. Less reliable if the shape is not round.
logarithm regression using these data:
* 9596961 -> 4 (China)
* 3287263 -> 5 (India)
* 643801 -> 6 (France)
* 6028 -> 9
* 1214 -> 10
* 891 -> 12
* 12 -> 13
In WolframAlpha:
>>> l... | 18 | 986 | 71 | 1,057 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import math
from searx.data import EXTERNAL_URLS
IMDB_PREFIX_TO_URL_ID = {
'tt': 'imdb_title',
'mn': 'imdb_name',
'ch': 'imdb_character',
'co': 'imdb_company',
'ev': 'imdb_event',
}
HTTP_WIKIMEDIA_IMAGE = 'ht... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import math
from searx.data import EXTERNAL_URLS
IMDB_PREFIX_TO_URL_ID = {
'tt': 'imdb_title',
'mn': 'imdb_name',
'ch': 'imdb_character',
'co': 'imdb_company',
'ev': 'imdb_event',
}
HTTP_WIKIMEDIA_IMAGE = 'ht... | |
23,914 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/flaskfix.py | 73,74 | 1,78 | patch_application | 74,78 | 74,78 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
from urllib.parse import urlparse
from werkzeug.middleware.proxy_fix import ProxyFix
from werkzeug.serving import WSGIRequestHandler
from searx import settings
class ReverseProxyPathFix:
'''Wrap the application in this midd... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
from urllib.parse import urlparse
from werkzeug.middleware.proxy_fix import ProxyFix
from werkzeug.serving import WSGIRequestHandler
from searx import settings
class ReverseProxyPathFix:
'''Wrap the application in this midd... | # serve pages with HTTP/1.1
WSGIRequestHandler.protocol_version = "HTTP/{}".format(settings['server']['http_protocol_version'])
# patch app to handle non root url-s behind proxy & wsgi
app.wsgi_app = ReverseProxyPathFix(ProxyFix(app.wsgi_app))
| # serve pages with HTTP/1.1
WSGIRequestHandler.protocol_version = "HTTP/{}".format(settings['server']['http_protocol_version'])
# patch app to handle non root url-s behind proxy & wsgi
app.wsgi_app = ReverseProxyPathFix(ProxyFix(app.wsgi_app))
| 23 | 784 | 91 | 875 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
from urllib.parse import urlparse
from werkzeug.middleware.proxy_fix import ProxyFix
from werkzeug.serving import WSGIRequestHandler
from searx import settings
class ReverseProxyPathFix:
'''Wrap the application in this midd... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
from urllib.parse import urlparse
from werkzeug.middleware.proxy_fix import ProxyFix
from werkzeug.serving import WSGIRequestHandler
from searx import settings
class ReverseProxyPathFix:
'''Wrap the application in this midd... | |
23,917 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/metrics/error_recorder.py | 151,152 | 1,196 | get_exception_classname | 152,160 | 152,160 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring, invalid-name
import typing
import inspect
from json import JSONDecodeError
from urllib.parse import urlparse
from httpx import HTTPError, HTTPStatusError
from searx.exceptions import (
SearxXPathSyntaxException,
SearxEngin... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring, invalid-name
import typing
import inspect
from json import JSONDecodeError
from urllib.parse import urlparse
from httpx import HTTPError, HTTPStatusError
from searx.exceptions import (
SearxXPathSyntaxException,
SearxEngin... | exc_class = exc.__class__
exc_name = exc_class.__qualname__
exc_module = exc_class.__module__
if exc_module is None or exc_module == str.__class__.__module__:
return exc_name
return exc_module + '.' + exc_name
| exc_class = exc.__class__
exc_name = exc_class.__qualname__
exc_module = exc_class.__module__
if exc_module is None or exc_module == str.__class__.__module__:
return exc_name
return exc_module + '.' + exc_name
| 25 | 1,950 | 85 | 2,035 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring, invalid-name
import typing
import inspect
from json import JSONDecodeError
from urllib.parse import urlparse
from httpx import HTTPError, HTTPStatusError
from searx.exceptions import (
SearxXPathSyntaxException,
SearxEngin... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring, invalid-name
import typing
import inspect
from json import JSONDecodeError
from urllib.parse import urlparse
from httpx import HTTPError, HTTPStatusError
from searx.exceptions import (
SearxXPathSyntaxException,
SearxEngin... | |
23,918 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/metrics/models.py | 151,152 | 128,159 | dump | CounterStorage | 152,159 | 152,159 | class CounterStorage: # pylint: disable=missing-class-docstring
__slots__ = 'counters', 'lock'
def __init__(self):
self.lock = threading.Lock()
self.clear()
def clear(self):
with self.lock:
self.counters = {}
def configure(self, *args):
with self.lock:
... | class CounterStorage: # pylint: disable=missing-class-docstring
__slots__ = 'counters', 'lock'
def __init__(self):
self.lock = threading.Lock()
self.clear()
def clear(self):
with self.lock:
self.counters = {}
def configure(self, *args):
with self.lock:
... | with self.lock:
ks = sorted(self.counters.keys(), key='/'.join) # pylint: disable=invalid-name
logger.debug("Counters:")
for k in ks:
logger.debug("- %-60s %s", '|'.join(k), self.counters[k])
| with self.lock:
ks = sorted(self.counters.keys(), key='/'.join) # pylint: disable=invalid-name
logger.debug("Counters:")
for k in ks:
logger.debug("- %-60s %s", '|'.join(k), self.counters[k])
| 19 | 184 | 94 | 278 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import decimal
import threading
from searx import logger
__all__ = ["Histogram", "HistogramStorage", "CounterStorage"]
logger = logger.getChild('searx.metrics')
class Histogram: # pylint: disable=missing-class-docstring
... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import decimal
import threading
from searx import logger
__all__ = ["Histogram", "HistogramStorage", "CounterStorage"]
logger = logger.getChild('searx.metrics')
class Histogram: # pylint: disable=missing-class-docstring
... |
23,919 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/metrics/models.py | 27,28 | 15,102 | observe | Histogram | 28,40 | 28,40 | class Histogram: # pylint: disable=missing-class-docstring
_slots__ = '_lock', '_size', '_sum', '_quartiles', '_count', '_width'
def __init__(self, width=10, size=200):
self._lock = threading.Lock()
self._width = width
self._size = size
self._quartiles = [0] * size
sel... | class Histogram: # pylint: disable=missing-class-docstring
_slots__ = '_lock', '_size', '_sum', '_quartiles', '_count', '_width'
def __init__(self, width=10, size=200):
self._lock = threading.Lock()
self._width = width
self._size = size
self._quartiles = [0] * size
sel... | q = int(value / self._width)
if q < 0: # pylint: disable=consider-using-max-builtin
# Value below zero is ignored
q = 0
if q >= self._size:
# Value above the maximum is replaced by the maximum
q = self._size - 1
with self._lock:
... | q = int(value / self._width)
if q < 0: # pylint: disable=consider-using-max-builtin
# Value below zero is ignored
q = 0
if q >= self._size:
# Value above the maximum is replaced by the maximum
q = self._size - 1
with self._lock:
... | 51 | 669 | 125 | 794 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import decimal
import threading
from searx import logger
__all__ = ["Histogram", "HistogramStorage", "CounterStorage"]
logger = logger.getChild('searx.metrics')
class Histogram: # pylint: disable=missing-class-docstring
... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import decimal
import threading
from searx import logger
__all__ = ["Histogram", "HistogramStorage", "CounterStorage"]
logger = logger.getChild('searx.metrics')
class Histogram: # pylint: disable=missing-class-docstring
... |
23,920 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/metrics/models.py | 113,114 | 102,128 | configure | HistogramStorage | 114,118 | 114,118 | class HistogramStorage: # pylint: disable=missing-class-docstring
__slots__ = 'measures', 'histogram_class'
def __init__(self, histogram_class=Histogram):
self.clear()
self.histogram_class = histogram_class
def clear(self):
self.measures = {}
def configure(self, width, size,... | class HistogramStorage: # pylint: disable=missing-class-docstring
__slots__ = 'measures', 'histogram_class'
def __init__(self, histogram_class=Histogram):
self.clear()
self.histogram_class = histogram_class
def clear(self):
self.measures = {}
def configure(self, width, size,... | measure = self.histogram_class(width, size)
self.measures[args] = measure
return measure
| measure = self.histogram_class(width, size)
self.measures[args] = measure
return measure
| 9 | 229 | 35 | 264 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import decimal
import threading
from searx import logger
__all__ = ["Histogram", "HistogramStorage", "CounterStorage"]
logger = logger.getChild('searx.metrics')
class Histogram: # pylint: disable=missing-class-docstring
... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import decimal
import threading
from searx import logger
__all__ = ["Histogram", "HistogramStorage", "CounterStorage"]
logger = logger.getChild('searx.metrics')
class Histogram: # pylint: disable=missing-class-docstring
... |
23,922 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/network/client.py | 80,81 | 62,98 | handle_async_request | AsyncHTTPTransportNoHttp | 81,83 | 81,83 | class AsyncHTTPTransportNoHttp(httpx.AsyncHTTPTransport):
"""Block HTTP request
The constructor is blank because httpx.AsyncHTTPTransport.__init__ creates an SSLContext unconditionally:
https://github.com/encode/httpx/blob/0f61aa58d66680c239ce43c8cdd453e7dc532bfc/httpx/_transports/default.py#L271
Each... | class AsyncHTTPTransportNoHttp(httpx.AsyncHTTPTransport):
"""Block HTTP request
The constructor is blank because httpx.AsyncHTTPTransport.__init__ creates an SSLContext unconditionally:
https://github.com/encode/httpx/blob/0f61aa58d66680c239ce43c8cdd453e7dc532bfc/httpx/_transports/default.py#L271
Each... | raise httpx.UnsupportedProtocol('HTTP protocol is disabled')
| raise httpx.UnsupportedProtocol('HTTP protocol is disabled')
| 5 | 329 | 18 | 347 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring, global-statement
import asyncio
import logging
import random
from ssl import SSLContext
import threading
from typing import Any, Dict
import httpx
from httpx_socks import AsyncProxyTransport
from python_socks import parse_proxy_u... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring, global-statement
import asyncio
import logging
import random
from ssl import SSLContext
import threading
from typing import Any, Dict
import httpx
from httpx_socks import AsyncProxyTransport
from python_socks import parse_proxy_u... |
23,923 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/network/client.py | 104,105 | 98,115 | handle_async_request | AsyncProxyTransportFixed | 105,115 | 105,115 | class AsyncProxyTransportFixed(AsyncProxyTransport):
"""Fix httpx_socks.AsyncProxyTransport
Map python_socks exceptions to httpx.ProxyError exceptions
"""
async def handle_async_request(self, request):
FILL_FUNC_BODY | class AsyncProxyTransportFixed(AsyncProxyTransport):
"""Fix httpx_socks.AsyncProxyTransport
Map python_socks exceptions to httpx.ProxyError exceptions
"""
async def handle_async_request(self, request):
FILL_FUNC_BODY | try:
return await super().handle_async_request(request)
except ProxyConnectionError as e:
raise httpx.ProxyError("ProxyConnectionError: " + e.strerror, request=request) from e
except ProxyTimeoutError as e:
raise httpx.ProxyError("ProxyTimeoutError: " + e.args... | try:
return await super().handle_async_request(request)
except ProxyConnectionError as e:
raise httpx.ProxyError("ProxyConnectionError: " + e.strerror, request=request) from e
except ProxyTimeoutError as e:
raise httpx.ProxyError("ProxyTimeoutError: " + e.args... | 40 | 69 | 139 | 208 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring, global-statement
import asyncio
import logging
import random
from ssl import SSLContext
import threading
from typing import Any, Dict
import httpx
from httpx_socks import AsyncProxyTransport
from python_socks import parse_proxy_u... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring, global-statement
import asyncio
import logging
import random
from ssl import SSLContext
import threading
from typing import Any, Dict
import httpx
from httpx_socks import AsyncProxyTransport
from python_socks import parse_proxy_u... |
23,926 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/network/raise_for_httperror.py | 31,32 | 1,78 | raise_for_cloudflare_captcha | 32,47 | 32,47 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Raise exception for an HTTP response is an error.
"""
from searx.exceptions import (
SearxEngineCaptchaException,
SearxEngineTooManyRequestsException,
SearxEngineAccessDeniedException,
)
from searx import get_setting
def is_cloudflare_challenge(resp):
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Raise exception for an HTTP response is an error.
"""
from searx.exceptions import (
SearxEngineCaptchaException,
SearxEngineTooManyRequestsException,
SearxEngineAccessDeniedException,
)
from searx import get_setting
def is_cloudflare_challenge(resp):
... | if resp.headers.get('Server', '').startswith('cloudflare'):
if is_cloudflare_challenge(resp):
# https://support.cloudflare.com/hc/en-us/articles/200170136-Understanding-Cloudflare-Challenge-Passage-Captcha-
# suspend for 2 weeks
raise SearxEngineCaptchaException(
... | if resp.headers.get('Server', '').startswith('cloudflare'):
if is_cloudflare_challenge(resp):
# https://support.cloudflare.com/hc/en-us/articles/200170136-Understanding-Cloudflare-Challenge-Passage-Captcha-
# suspend for 2 weeks
raise SearxEngineCaptchaException(
... | 26 | 757 | 236 | 993 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Raise exception for an HTTP response is an error.
"""
from searx.exceptions import (
SearxEngineCaptchaException,
SearxEngineTooManyRequestsException,
SearxEngineAccessDeniedException,
)
from searx import get_setting
def is_cloudflare_challenge(resp):
... | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Raise exception for an HTTP response is an error.
"""
from searx.exceptions import (
SearxEngineCaptchaException,
SearxEngineTooManyRequestsException,
SearxEngineAccessDeniedException,
)
from searx import get_setting
def is_cloudflare_challenge(resp):
... | |
23,927 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/plugins/ahmia_filter.py | 22,23 | 1,29 | init | 23,29 | 23,29 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
from hashlib import md5
from searx.data import ahmia_blacklist_loader
name = "Ahmia blacklist"
description = "Filter out onion results that appear in Ahmia's blacklist. (See https://ahmia.fi/blacklist)"
default_on = True
preferenc... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
from hashlib import md5
from searx.data import ahmia_blacklist_loader
name = "Ahmia blacklist"
description = "Filter out onion results that appear in Ahmia's blacklist. (See https://ahmia.fi/blacklist)"
default_on = True
preferenc... | global ahmia_blacklist # pylint: disable=global-statement
if not settings['outgoing']['using_tor_proxy']:
# disable the plugin
return False
ahmia_blacklist = ahmia_blacklist_loader()
return True
| global ahmia_blacklist # pylint: disable=global-statement
if not settings['outgoing']['using_tor_proxy']:
# disable the plugin
return False
ahmia_blacklist = ahmia_blacklist_loader()
return True
| 19 | 231 | 74 | 305 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
from hashlib import md5
from searx.data import ahmia_blacklist_loader
name = "Ahmia blacklist"
description = "Filter out onion results that appear in Ahmia's blacklist. (See https://ahmia.fi/blacklist)"
default_on = True
preferenc... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
from hashlib import md5
from searx.data import ahmia_blacklist_loader
name = "Ahmia blacklist"
description = "Filter out onion results that appear in Ahmia's blacklist. (See https://ahmia.fi/blacklist)"
default_on = True
preferenc... | |
23,928 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/plugins/hash_plugin.py | 19,20 | 1,44 | post_search | 20,44 | 20,44 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import hashlib
import re
from flask_babel import gettext
name = "Hash plugin"
description = gettext("Converts strings to different hash digests.")
default_on = True
preference_section = 'query'
query_keywords = ['md5', 'sha1', 's... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import hashlib
import re
from flask_babel import gettext
name = "Hash plugin"
description = gettext("Converts strings to different hash digests.")
default_on = True
preference_section = 'query'
query_keywords = ['md5', 'sha1', 's... | # process only on first page
if search.search_query.pageno > 1:
return True
m = parser_re.match(search.search_query.query)
if not m:
# wrong query
return True
function, string = m.groups()
if not string.strip():
# end if the string is empty
return True
... | # process only on first page
if search.search_query.pageno > 1:
return True
m = parser_re.match(search.search_query.query)
if not m:
# wrong query
return True
function, string = m.groups()
if not string.strip():
# end if the string is empty
return True
... | 78 | 219 | 232 | 451 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import hashlib
import re
from flask_babel import gettext
name = "Hash plugin"
description = gettext("Converts strings to different hash digests.")
default_on = True
preference_section = 'query'
query_keywords = ['md5', 'sha1', 's... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import hashlib
import re
from flask_babel import gettext
name = "Hash plugin"
description = gettext("Converts strings to different hash digests.")
default_on = True
preference_section = 'query'
query_keywords = ['md5', 'sha1', 's... | |
23,929 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/plugins/hostname_replace.py | 26,27 | 1,50 | on_result | 27,50 | 27,50 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import re
from urllib.parse import urlunparse, urlparse
from flask_babel import gettext
from searx import settings
from searx.plugins import logger
name = gettext('Hostname replace')
description = gettext('Rewrite result hostnam... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import re
from urllib.parse import urlunparse, urlparse
from flask_babel import gettext
from searx import settings
from searx.plugins import logger
name = gettext('Hostname replace')
description = gettext('Rewrite result hostnam... |
for pattern, replacement in replacements.items():
if parsed in result:
if pattern.search(result[parsed].netloc):
# to keep or remove this result from the result list depends
# (only) on the 'parsed_url'
if not replacement:
ret... |
for pattern, replacement in replacements.items():
if parsed in result:
if pattern.search(result[parsed].netloc):
# to keep or remove this result from the result list depends
# (only) on the 'parsed_url'
if not replacement:
ret... | 66 | 244 | 271 | 515 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import re
from urllib.parse import urlunparse, urlparse
from flask_babel import gettext
from searx import settings
from searx.plugins import logger
name = gettext('Hostname replace')
description = gettext('Rewrite result hostnam... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import re
from urllib.parse import urlunparse, urlparse
from flask_babel import gettext
from searx import settings
from searx.plugins import logger
name = gettext('Hostname replace')
description = gettext('Rewrite result hostnam... | |
23,930 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/plugins/oa_doi_rewrite.py | 18,19 | 1,51 | extract_doi | 19,29 | 19,29 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import re
from urllib.parse import urlparse, parse_qsl
from flask_babel import gettext
from searx import settings
regex = re.compile(r'10\.\d{4,9}/[^\s]+')
name = gettext('Open Access DOI rewrite')
description = gettext('Avoid p... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import re
from urllib.parse import urlparse, parse_qsl
from flask_babel import gettext
from searx import settings
regex = re.compile(r'10\.\d{4,9}/[^\s]+')
name = gettext('Open Access DOI rewrite')
description = gettext('Avoid p... | match = regex.search(url.path)
if match:
return match.group(0)
for _, v in parse_qsl(url.query):
match = regex.search(v)
if match:
return match.group(0)
return None
| match = regex.search(url.path)
if match:
return match.group(0)
for _, v in parse_qsl(url.query):
match = regex.search(v)
if match:
return match.group(0)
return None
| 21 | 451 | 81 | 532 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import re
from urllib.parse import urlparse, parse_qsl
from flask_babel import gettext
from searx import settings
regex = re.compile(r'10\.\d{4,9}/[^\s]+')
name = gettext('Open Access DOI rewrite')
description = gettext('Avoid p... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
import re
from urllib.parse import urlparse, parse_qsl
from flask_babel import gettext
from searx import settings
regex = re.compile(r'10\.\d{4,9}/[^\s]+')
name = gettext('Open Access DOI rewrite')
description = gettext('Avoid p... | |
23,931 | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng | /home/hieuvd/dung_repo/raw/stars_01/searxng_searxng/searxng/searx/plugins/self_info.py | 20,21 | 1,30 | post_search | 21,30 | 21,30 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring,invalid-name
import re
from flask_babel import gettext
from searx.botdetection._helpers import get_real_ip
name = gettext('Self Information')
description = gettext('Displays your IP if the query is "ip" and your user agent if the... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring,invalid-name
import re
from flask_babel import gettext
from searx.botdetection._helpers import get_real_ip
name = gettext('Self Information')
description = gettext('Displays your IP if the query is "ip" and your user agent if the... | if search.search_query.pageno > 1:
return True
if search.search_query.query == 'ip':
ip = get_real_ip(request)
search.result_container.answers['ip'] = {'answer': ip}
elif p.match(search.search_query.query):
ua = request.user_agent
search.result_container.answers['user... | if search.search_query.pageno > 1:
return True
if search.search_query.query == 'ip':
ip = get_real_ip(request)
search.result_container.answers['ip'] = {'answer': ip}
elif p.match(search.search_query.query):
ua = request.user_agent
search.result_container.answers['user... | 28 | 197 | 126 | 323 | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring,invalid-name
import re
from flask_babel import gettext
from searx.botdetection._helpers import get_real_ip
name = gettext('Self Information')
description = gettext('Displays your IP if the query is "ip" and your user agent if the... | # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring,invalid-name
import re
from flask_babel import gettext
from searx.botdetection._helpers import get_real_ip
name = gettext('Self Information')
description = gettext('Displays your IP if the query is "ip" and your user agent if the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.