Google Engines

google API

For detailed description of the REST-full API see: Query Parameter Definitions. Not all parameters can be appied and some engines are special (e.g. Google News).

Google WEB

This is the implementation of the google WEB engine. Some of this implementations are shared by other engines:

The google WEB engine itself has a special setup option:

- name: google
  ...
  use_mobile_ui: false
use_mobile_ui: (default: false)

Enables to use mobile endpoint to bypass the google blocking (see #159). On the mobile UI of Google Search, the button More results is not affected by Google rate limiting and we can still do requests while actively blocked by the original Google search. By activate use_mobile_ui this behavior is simulated by adding the parameter async=use_ac:true,_fmt:pc to the request().

searx.engines.google.get_lang_info(params, lang_list, custom_aliases, supported_any_language)[source]

Composing various language properties for the google engines.

This function is called by the various google engines (Google WEB, Google Images, Google News and Google Videos).

Parameters:
  • param (dict) – request parameters of the engine

  • lang_list (dict) – list of supported languages of the engine ENGINES_LANGUAGES[engine-name]

  • lang_list – custom aliases for non standard language codes (used when calling searx.utils.match_language())

  • supported_any_language (bool) – When a language is not specified, the language interpretation is left up to Google to decide how the search results should be delivered. This argument is True for the google engine and False for the other engines (google-images, -news, -scholar, -videos).

Return type:

dict

Returns:

Py-Dictionary with the key/value pairs:

language:

Return value from searx.utils.match_language()

country:

The country code (e.g. US, AT, CA, FR, DE ..)

subdomain:

Google subdomain google_domains that fits to the country code.

params:

Py-Dictionary with additional request arguments (can be passed to urllib.parse.urlencode()).

headers:

Py-Dictionary with additional HTTP headers (can be passed to request’s headers)

searx.engines.google.request(query, params)[source]

Google search request

searx.engines.google.response(resp)[source]

Get response from google’s search request

Google Images

This is the implementation of the google images engine.

Content-Security-Policy (CSP)

This engine needs to allow images from the data URLs (prefixed with the data: scheme):

Header set Content-Security-Policy "img-src 'self' data: ;"
searx.engines.google_images.get_img_url_by_data_id(data_id_to_img_url, img_node)[source]

Get full image URL by @data-id from parent element.

searx.engines.google_images.request(query, params)[source]

Google-Video search request

searx.engines.google_images.response(resp)[source]

Get response from google’s search request

searx.engines.google_images.scrap_out_thumbs(dom)[source]

Scrap out thumbnail data from <script> tags.

Google Videos

This is the implementation of the google videos engine.

Content-Security-Policy (CSP)

This engine needs to allow images from the data URLs (prefixed with the data: scheme):

Header set Content-Security-Policy "img-src 'self' data: ;"
searx.engines.google_videos.request(query, params)[source]

Google-Video search request

searx.engines.google_videos.response(resp)[source]

Get response from google’s search request

searx.engines.google_videos.scrap_out_thumbs(dom)[source]

Scrap out thumbnail data from <script> tags.

Google News

This is the implementation of the google news engine. The google news API ignores some parameters from the common google API:

  • num : the number of search results is ignored

  • save : is ignored / Google-News results are always SafeSearch

searx.engines.google_news.request(query, params)[source]

Google-News search request

searx.engines.google_news.response(resp)[source]

Get response from google’s search request