SerpApi Official icon

SerpApi Official

Get live Google Search data and more from SerpApi's official node

Overview

This node enables users to perform live Baidu web searches through SerpApi's official API integration. It allows querying Baidu's search engine with various parameters to customize the search results, such as language restrictions, pagination, device type, and output format. This node is beneficial for automating data retrieval from Baidu search results in workflows that require real-time or customized search data extraction.

Practical examples include:

  • Retrieving the top 10 Chinese-language search results for a specific keyword.
  • Paginating through Baidu search results by adjusting the offset.
  • Filtering search results by time period or restricting results to a particular domain.
  • Fetching raw HTML of search results for custom parsing or analysis.

Properties

Name Meaning
Search Query (q) The main search query string including Baidu search operators like inurl:, site:, intitle:, etc. Example: "Coffee".
Additional Fields A collection of optional parameters to further customize the search:
- Choose Language (ct) Restricts results by language: All Languages, Simplified Chinese, Traditional Chinese.
- Result Offset (pn) Number of results to skip for pagination (e.g., 0 for first page, 10 for second page).
- Number of Results (rn) Maximum number of results to return (up to 50). Default is 10. Only applicable for desktop/tablet searches.
- Time Period for Results (gpc) Unix timestamps defining the time range for results (e.g., last 7 days).
- Search Type (q5) Search by page title or web address (e.g., 1 for page title, 2 for web address).
- Search Type (q6) Restrict search to a specific domain (e.g., serpapi.com).
- Previous Search Query (bs) Defines the previous search query to simulate navigation history.
- Original Search Query (oq) Defines the original search query when navigating from related searches.
- Originating Search Type (f) Indicates the source of the search (e.g., 8 = normal search, 3 = suggestion list, 1 = related search).
- Device (device) Device type for search results: desktop (default), tablet, or mobile.
- Disable Caching (no_cache) If true, forces fetching fresh results ignoring cached data. Cache expires after 1 hour. Defaults to false. Cannot be used with async.
- Async (async) If true, submits search asynchronously; results must be retrieved later via Search Archive API. Defaults to false. Cannot be used with no_cache or on accounts with Ludicrous Speed enabled.
- ZeroTrace Mode (zero_trace) Enterprise-only mode to avoid storing search parameters and metadata on servers. Defaults to false.
- Output (output) Format of the final output: JSON (default) for structured data or HTML for raw HTML content.
- JSON Restrictor (json_restrictor) Limits fields returned in the JSON response, e.g., only titles and snippets of the first 3 organic results.

Output

The node outputs a JSON object containing the search results from Baidu as returned by SerpApi. The structure includes various fields representing organic results, ads, related searches, and other metadata depending on the query and parameters.

If the output format is set to html, the node returns the raw HTML content of the search results page instead of structured JSON.

No binary data output is produced by this node.

Dependencies

  • Requires an active SerpApi account with a valid API key credential configured in n8n.
  • Internet access to call SerpApi endpoints.
  • No additional external dependencies beyond the SerpApi service.

Troubleshooting

  • Common issues:

    • Invalid or missing API key credential will cause authentication errors.
    • Using incompatible parameter combinations, such as setting both no_cache and async to true, will result in errors.
    • Requesting more than 50 results (rn parameter) will be ignored or cause errors.
    • Using async mode without retrieving results later via Search Archive API will lead to incomplete workflows.
  • Error messages:

    • Authentication failures: Verify API key credential is correctly set up.
    • Parameter validation errors: Check that all required parameters are provided and options are valid.
    • Rate limiting or quota exceeded: Ensure your SerpApi plan supports the volume of requests.

Links and References

Discussion