Wikimedia

Wikipedia

This module implements the Wikipedia engine. Some of this implementations are shared by other engines:

The list of supported languages is fetched from the article linked by wikipedia_article_depth. Unlike traditional search engines, wikipedia does not support one Wikipedia for all the languages, but there is one Wikipedia for every language (fetch_traits).

searx.engines.wikipedia.fetch_traits(engine_traits: EngineTraits)[source]

Fetch languages from Wikipedia.

The location of the Wikipedia address of a language is mapped in a custom field (wiki_netloc). Here is a reduced example:

traits.custom['wiki_netloc'] = {
    "en": "en.wikipedia.org",
    ..
    "gsw": "als.wikipedia.org",
    ..
    "zh": "zh.wikipedia.org",
    "zh-classical": "zh-classical.wikipedia.org"
}
searx.engines.wikipedia.request(query, params)[source]

Assemble a request (wikipedia rest_v1 summary API).

searx.engines.wikipedia.rest_v1_summary_url = 'https://{wiki_netloc}/api/rest_v1/page/summary/{title}'

wikipedia rest_v1 summary API: The summary response includes an extract of the first paragraph of the page in plain text and HTML as well as the type of page. This is useful for page previews (fka. Hovercards, aka. Popups) on the web and link previews in the apps.

searx.engines.wikipedia.wikipedia_article_depth = 'https://meta.wikimedia.org/wiki/Wikipedia_article_depth'

The editing depth of Wikipedia is one of several possible rough indicators of the encyclopedia’s collaborative quality, showing how frequently its articles are updated. The measurement of depth was introduced after some limitations of the classic measurement of article count were realized.

Wikidata

This module implements the Wikidata engine. Some implementations are shared from Wikipedia.

searx.engines.wikidata.fetch_traits(engine_traits: EngineTraits)[source]

Use languages evaluated from wikipedia.fetch_traits except zh-classical (zh_Hans) what is not supported by wikidata.

searx.engines.wikidata.get_thumbnail(img_src)[source]

Get Thumbnail image from wikimedia commons

Images from commons.wikimedia.org are (HTTP) redirected to upload.wikimedia.org. The redirected URL can be calculated by this function.