toolregistry.hub.websearch.websearch_google module

class toolregistry.hub.websearch.websearch_google.WebSearchGoogle(google_base_url: str = 'https://www.google.com', proxy: str | None = None)[source]

Bases: WebSearchGeneral

WebSearchGoogle provides a unified interface for performing web searches on Google. It handles search queries and result processing.

Features: - Performs web searches using Google - Returns formatted results with title, URL and description - Supports proxy and region settings

Examples

>>> from toolregistry.hub.websearch_google import WebSearchGoogle
>>> searcher = WebSearchGoogle()
>>> results = searcher.search("python web scraping", number_results=3)
>>> for result in results:
...     print(result["title"])
__init__(google_base_url: str = 'https://www.google.com', proxy: str | None = None)[source]

Initialize WebSearchGoogle with configuration parameters.

Parameters:
search(query: str, number_results: int = 5, threshold: float = 0.2, timeout: float | None = None) List[Dict[str, str]][source]

Perform search and return results.

Parameters:
  • query – The search query.

  • number_results – The maximum number of results to return. Default is 5.

  • timeout – Optional timeout override in seconds.

Returns:

  • ‘title’: The title of the search result

  • ’url’: The URL of the search result

  • ’content’: The description/content from Google

  • ’excerpt’: Same as content (for compatibility with WebSearchSearxng)

Return type:

List of search results, each containing