SerpApi Official icon

SerpApi Official

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

Overview

This node integrates with SerpApi's Google News search engine to fetch live news data from Google News. It allows users to perform customized news searches by specifying queries, topics, publications, and other parameters. This is useful for monitoring current events, tracking news on specific subjects, or aggregating news content for analysis.

Practical examples include:

  • Searching for the latest news articles about a particular event or topic.
  • Retrieving news from a specific publisher like CNN or BBC.
  • Accessing news coverage of a specific story or sub-section within a topic.
  • Filtering news results by country or language preferences.

Properties

Name Meaning
Search Query (q) The search term or query string to find relevant news articles. Cannot be used together with publication_token, story_token, or topic_token.
Additional Fields A collection of optional parameters to refine the search:
- Country (gl) Country code to localize the news search (e.g., "us" for United States, "gb" for United Kingdom).
- Language (hl) Language code to specify the language of the news results (e.g., "en" for English, "fr" for French).
- Topic Token (topic_token) Token representing a specific Google News topic (e.g., "World", "Business"). Cannot be used with q, story_token, or publication_token.
- Publication Token (publication_token) Token representing a specific news publisher (e.g., CNN, BBC). Cannot be used with q, story_token, or topic_token.
- Section Token (section_token) Token representing a subsection of a topic or publication (e.g., "Business -> Economy"). Can only be used with topic_token or publication_token.
- Story Token (story_token) Token representing a specific news story for full coverage. Cannot be used with q, topic_token, or publication_token.
- Sort By (so) Sorting method for results: "Relevance" or "Date".
- Disable Caching (no_cache) Boolean flag to force fetching fresh results instead of cached ones. Cached results expire after 1 hour. Cannot be used with async.
- Async (async) Boolean flag to perform the search asynchronously. If true, results must be retrieved later via a separate API call. Cannot be used with no_cache or on 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.
- Output (output) Format of the output: "json" for structured JSON (default) or "html" for raw HTML response.
- JSON Restrictor (json_restrictor) String to restrict fields in the JSON response, e.g., limiting to certain fields or number of results.

Output

The node outputs a JSON object containing the search results from Google News as returned by SerpApi. The structure includes various fields such as news articles, metadata, and possibly tokens for further navigation or filtering.

If the output format is set to "html," the node returns the raw HTML content of the Google News page.

No binary data output is indicated.

Dependencies

  • Requires an active SerpApi account with a valid API key credential configured in n8n.
  • The node sends HTTP requests to https://serpapi.com/search.json with appropriate query parameters based on user input.
  • No additional external dependencies are required beyond the API key and internet access.

Troubleshooting

  • Common Issues:

    • Using mutually exclusive parameters together (e.g., providing both q and publication_token) will likely cause errors or unexpected results.
    • Incorrect or expired API keys will result in authentication errors.
    • Using asynchronous mode (async=true) requires handling retrieval of results separately; forgetting this may lead to empty or incomplete data.
    • Setting invalid country or language codes may yield no results or default behavior.
  • Error Messages:

    • Authentication failures: Check that the API key credential is correctly set up and valid.
    • Parameter conflicts: Ensure that mutually exclusive parameters are not combined.
    • Rate limits or quota exceeded: Verify your SerpApi plan and usage limits.
    • Invalid tokens: Confirm that topic, publication, section, or story tokens are correct and current.

Links and References

Discussion