# Google Trends Trending Now Scraper (`digitals-lab/analysis`) Actor

Get today's trending Google searches for up to 20 countries in one run: trend, approximate traffic, publish time, picture and related news. Public RSS feed, plain HTTP, no login or proxy.

- **URL**: https://apify.com/digitals-lab/analysis.md
- **Developed by:** [URPSM](https://apify.com/digitals-lab) (community)
- **Categories:** SEO tools, News
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 analysis results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Google Trends Trending Now Scraper

Extract real-time trending search topics, search volume indicators, and related news articles from Google's official public **Trending Now RSS feed** (`https://trends.google.com/trending/rss?geo=<XX>`) across up to 20 countries in a single run.

Built with **TypeScript + Crawlee** following the official Apify Actor architecture. 100% plain HTTP: zero proxies, zero credentials, zero browser emulation required.

***

### Key Features

- **Multi-Country Extraction**: Fetch real-time trending topics for up to 20 ISO country codes (e.g. US, GB, FR, DE, JP, BR) simultaneously.
- **Fast & Lightweight**: Direct HTTP requests without headless browsers. A typical run takes between 0.8s and 2.5s and consumes less than 128 MB of RAM.
- **Rich Structured Output**: Returns search trend titles, approximate traffic volume (e.g. `50K+`, `100K+`, `500+`), publication timestamps in ISO 8601, picture links, item source links, and related news articles.
- **Per-Geo Fault Isolation**: Unhandled or invalid country codes (HTTP 400 from Google) are captured in `stats.json` without failing other requested countries.
- **Production Audit Trail**: Every run saves detailed execution metrics to `stats.json` in the default Key-Value Store.
- **Enterprise-Ready Schemas**: Fully documented and compliant Apify schemas for Input, Dataset, Output, and Key-Value Store.

***

### Use Cases

1. **SEO & Content Strategy**: Identify breakout topics and search spikes the moment they happen to create timely, high-ranking content.
2. **News Desks & Journalists**: Monitor emerging news and breaking stories across multiple international jurisdictions.
3. **Social Media & Influencer Marketing**: Align social campaigns with real-time viral interest and trending search conversations.
4. **Market & Competitor Intelligence**: Track global product trends, consumer shifts, and brand mentions across international markets.
5. **Automated Trading & Sentiment Feeds**: Feed fresh trend signals and associated news directly into analytical models or alert systems.

***

### Input Configuration

The Actor is configured through standard JSON input. The input schema is validated at runtime before requests are dispatched.

| Field | Type | Default | Prefill | Allowed Limits | Description |
|---|---|---|---|---|---|
| `geo` | Array of strings | `["US"]` | `["US"]` | 1 to 20 items (`^[A-Z]{2}$`) | ISO 3166-1 alpha-2 country codes. Duplicates are automatically deduplicated. |
| `limit` | Integer | `10` | `10` | 1 to 10 | Maximum number of trend items retained per country. Google's public feed publishes up to 10 items. |
| `newsLimit` | Integer | `3` | `3` | 0 to 5 | Maximum number of attached news articles per trend item. Set to `0` to omit news articles. |

#### Input Examples

##### 1. Quick Start (Default single-country query)

```json
{
  "geo": ["US"]
}
```

##### 2. Multi-Country Market Monitoring

```json
{
  "geo": ["US", "GB", "CA", "AU"],
  "limit": 10,
  "newsLimit": 3
}
```

##### 3. High-Frequency Keyword Extraction (Zero news payload)

```json
{
  "geo": ["FR", "DE", "IT", "ES"],
  "limit": 10,
  "newsLimit": 0
}
```

***

### Output Data Structure

#### 1. Default Dataset Items (1 Item = 1 Trending Topic)

Each dataset record provides clean, structured data for a single trending query:

```json
{
  "geo": "US",
  "trend": "Artificial Intelligence Breakthrough",
  "approxTraffic": "50K+",
  "publishedAt": "2026-11-19T02:00:00.000Z",
  "pictureUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRsample",
  "pictureSource": "Tech News",
  "trendsFeedUrl": "https://trends.google.com/trending/rss?geo=US",
  "news": [
    {
      "title": "New Frontier in AI Computing Announced",
      "url": "https://example.com/ai-news",
      "source": "Tech Journal",
      "snippet": "Researchers demonstrate significant efficiency gains.",
      "pictureUrl": "https://example.com/pic.jpg"
    }
  ],
  "fetchedAt": "2026-11-19T04:15:00.000Z"
}
```

##### Field Explanations:

- `geo`: ISO 3166-1 alpha-2 country code corresponding to this trend.
- `trend`: Clean topic name / trending search phrase.
- `approxTraffic`: Google's raw search volume badge (`500+`, `10K+`, `50K+`, `500K+`, `1M+`).
- `publishedAt`: Feed publication date formatted in ISO 8601 UTC.
- `pictureUrl`: Featured image URL provided in Google's feed, or `null`.
- `pictureSource`: Attribution source name for the featured picture, or `null`.
- `trendsFeedUrl`: Canonical feed URL or item link.
- `news`: Array of attached news articles (up to `newsLimit`).
- `fetchedAt`: UTC timestamp when the Actor executed the extraction.

#### 2. Run Audit in Key-Value Store (`stats.json`)

Stored in the default Key-Value Store at `records/stats.json`:

```json
{
  "geosRequis": 3,
  "geosOk": 3,
  "geosEchoues": 0,
  "erreurs": [],
  "itemsDataset": 30,
  "dureeSec": 1.8,
  "fetchedAt": "2026-11-19T04:15:00.000Z"
}
```

When a country fails (e.g. invalid code `XX`), it is documented in `erreurs`:

```json
{
  "geo": "XX",
  "httpStatus": 400,
  "raison": "HTTP 400 Bad Request du flux Google (code pays non pris en charge)",
  "tentatives": 3
}
```

***

### Schema Contracts

The Actor defines strict schemas located in `.actor/`:

- [Input Schema](.actor/input_schema.json) — Validates incoming JSON parameters.
- [Dataset Schema](.actor/dataset_schema.json) — Declares dataset fields, types, and the default `Overview` table view.
- [Output Schema](.actor/output_schema.json) — Links dataset items and key-value store stats.
- [Key-Value Store Schema](.actor/key_value_store_schema.json) — Specifies structure for `stats.json`.

***

### Technical Specifications & Honest Limitations

- **Source Endpoint**: Extracts directly from `https://trends.google.com/trending/rss?geo=<XX>`.
- **Feed Item Cap**: The public RSS feed publishes at most 10 items per country. Setting `limit` higher than 10 is not allowed.
- **Country Cap**: Maximum of 20 countries per run. For global tracking of 100+ countries, trigger multiple concurrent runs via the Apify API.
- **Attached News**: Google typically attaches 1 to 3 news articles per trend. Even if `newsLimit` is set to 5, the feed will deliver at most what Google publishes.
- **Historical Trends**: This Actor extracts real-time "Trending Now" queries. Historical interest data, interest-over-time curves, and related query graphs are part of Google Trends explore pages and require separate exploration methods.
- **Resource Consumption**: Minimal memory requirement (128 MB or 256 MB is sufficient). Runs typically finish within 1–3 seconds, resulting in negligible Apify platform compute costs.

***

### Frequently Asked Questions (FAQ)

#### Do I need a proxy or Google login?

No. The RSS feed is public and does not require authentication, sessions, cookies, or proxy rotation. Standard HTTP requests work reliably.

#### What happens if I provide an invalid country code?

Google returns `HTTP 400 Bad Request`. The Actor retries twice with exponential backoff (2s, 5s), then logs the error in `stats.json.erreurs` and proceeds with the remaining valid countries. The run only terminates with exit code 1 if every single requested country fails.

#### What happens if I duplicate country codes in `geo`?

Duplicates are safely deduplicated at initialization (e.g. `["US", "US"]` becomes `["US"]`). An informational message is logged and only one network request is dispatched.

#### How often should I schedule this Actor?

Google updates the Trending Now RSS feed several times throughout the day as news breaks. Running this Actor once per hour or every 30 minutes provides an accurate stream of breaking search queries.

#### How can I integrate the output into my application?

You can query the dataset through Apify's REST API:

```bash
curl "https://api.apify.com/v2/datasets/<DATASET_ID>/items?format=json"
```

Or download formatted exports as CSV, JSON, Excel, or NDJSON directly from the Apify Console.

***

### Changelog & Version History

See [CHANGELOG.md](CHANGELOG.md) for full release details.

- **v0.0.3**: Quality score upgrade, non-root Docker execution (`USER myuser`), enriched input schema with prefill and examples, automated contract test suite, and GitHub Actions CI.
- **v0.0.2**: Dataset, output, and key-value store storage schemas added; fixed dataset retention.
- **v0.0.1**: Initial public release.

# Changelog

This Actor's version history is a separate document: https://apify.com/digitals-lab/analysis/changelog.md

# Actor input Schema

## `geo` (type: `array`):

Array of ISO 3166-1 alpha-2 uppercase country codes to query (e.g. US, GB, FR, DE, JP). Each country is fetched independently; unhandled or invalid codes return HTTP 400 and are recorded in stats.json without failing other requested countries.

## `limit` (type: `integer`):

Maximum number of trending search topics to retain per country. The public Google Trends RSS feed provides up to 10 topics per country, making 10 the hard upper limit.

## `newsLimit` (type: `integer`):

Maximum number of related news articles (ht:news_item) to keep per trending topic. Set to 0 to omit news articles and keep only trend keywords and traffic metrics.

## Actor input object example

```json
{
  "geo": [
    "US",
    "GB",
    "FR"
  ],
  "limit": 10,
  "newsLimit": 3
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `stats` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "geo": [
        "US"
    ],
    "limit": 10,
    "newsLimit": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("digitals-lab/analysis").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "geo": ["US"],
    "limit": 10,
    "newsLimit": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("digitals-lab/analysis").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "geo": [
    "US"
  ],
  "limit": 10,
  "newsLimit": 3
}' |
apify call digitals-lab/analysis --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,digitals-lab/analysis"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/aLThUkB6h58Lxb4nw/builds/cIGkJ22noBMNTMsDt/openapi.json
