SerpApi Official icon

SerpApi Official

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

Overview

The YouTube Search operation in this node allows users to perform live searches on YouTube using SerpApi's official API. It enables retrieving search results based on a query string and various optional parameters such as country, language, filters, and output format. This node is useful for automating the retrieval of YouTube video data, monitoring trends, or integrating YouTube search results into workflows without manually visiting the YouTube website.

Practical examples:

  • Automatically fetch the latest videos related to a specific topic (e.g., "Coffee") for content curation.
  • Monitor trending videos in a particular country or language.
  • Retrieve raw HTML or structured JSON data for further processing or analysis.

Properties

Name Meaning
Search Query (search_query) The main search term or phrase to query on YouTube. Accepts any string you would normally use in a YouTube search.
Additional Fields A collection of optional parameters to refine the search:
- Country (gl) Defines the country code to localize the search results (e.g., "us" for United States, "de" for Germany). A long list of ISO country codes is available.
- Language (hl) Defines the language code for the search interface and results (e.g., "en" for English, "fr" for French). Many language options are supported.
- Filter (sp) Used for pagination or filtering results. For pagination, use the next_page_token from previous responses. For filters, set desired YouTube filters and copy the sp parameter from the URL.
- Disable Caching (no_cache) Boolean flag to force fetching fresh results instead of cached ones. Defaults to false (allow cache). Cached results are free and expire after 1 hour. Cannot be used with async mode.
- Async (async) Boolean flag to perform the search asynchronously. If true, the search is submitted and results must be retrieved later via the Search Archive API. Cannot be used with no_cache and not recommended for accounts with Ludicrous Speed enabled.
- ZeroTrace Mode (zero_trace) Enterprise-only boolean flag to disable storing search parameters and metadata on SerpApi servers for privacy. Defaults to false.
- Output (output) Defines the output format: "json" (default) returns structured JSON results; "html" returns raw HTML of the search page.
- JSON Restrictor (json_restrictor) Allows restricting the JSON response fields to specific parts, e.g., limiting to certain result items or fields for more concise output.

Output

The node outputs a JSON object containing the YouTube search results as returned by SerpApi. The structure includes various fields such as organic results, pagination tokens, and metadata depending on the query and parameters.

If the output format is set to "html", the node returns the raw HTML content of the YouTube search results page.

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 the SerpApi endpoint at https://serpapi.com/search.json.
  • Proper configuration of the API key credential in n8n to authenticate requests.

Troubleshooting

  • Common issues:

    • Missing or invalid API key credential will cause authentication errors.
    • Using incompatible combinations of parameters, such as setting both no_cache and async to true, will result in errors.
    • Exceeding SerpApi usage limits may lead to rate limiting or quota errors.
    • Incorrect country or language codes may yield unexpected or empty results.
  • Error messages and resolutions:

    • Authentication failed: Verify that the API key credential is correctly set up and has necessary permissions.
    • Invalid parameter combination: Avoid using no_cache and async together.
    • Quota exceeded: Check your SerpApi account limits and upgrade if necessary.
    • Empty results: Confirm the search query and filter parameters are valid and return expected data on YouTube.

Links and References

Discussion