# Google News Sitemap Extractor (`stellar_ballet_0bu/sitemap-news-sitemap-extractor`) Actor

Fetch any public Google News sitemap (news: namespace) and emit per-article rows: title, publication date, publication name+language, genres, keywords, stock tickers. Handles sitemap indexes. Pairs with sitemap-delta-monitor as a news-only pre-filter for media monitoring and RAG news feeds.

- **URL**: https://apify.com/stellar\_ballet\_0bu/sitemap-news-sitemap-extractor.md
- **Developed by:** [Nikita S](https://apify.com/stellar_ballet_0bu) (community)
- **Categories:** Developer tools, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Google News Sitemap Extractor

Fetch any public **Google News sitemap** (`news:` namespace) and emit per-article rows: title, publication date, publication name+language, genres, keywords, and stock tickers. Handles sitemap indexes (BFS, deduped). Sits next to the public `sitemap-delta-monitor` as a news-only pre-filter for media monitoring and RAG news feeds.

### What it does

- Reads a public HTTP(S) URL of a Google News sitemap **or** a sitemap index that points to one.
- Walks sitemap indexes breadth-first, deduplicating by URL.
- Emits one dataset row per article that matches an optional `from` / `to` date window.
- Drops articles missing `<news:publication_date>` unless `includeUnparsedDate` is true.
- Records indexes / skipped non-news sitemaps / fetch errors as separate row kinds so the run is auditable.
- Pure data utility. Public sitemaps only — no auth, no anti-bot bypass, no scraping of article bodies.

### Who it is for

- **Media monitoring / news aggregators** that need a fresh window of publisher articles.
- **RAG pipelines** that want a fast, structured feed of news titles + publication dates for re-indexing.
- **Trading / equities workflows** that mine `stockTickers` from publisher feeds.
- **SEO teams** that want to confirm a publisher's Google News sitemap is being kept fresh and well-formed.
- Anyone who needs a deterministic, low-cost pull from the public `news:` namespace without standing up their own crawler.

### Quick start

1. Pick a publisher's Google News sitemap URL. The schema is documented at <https://www.google.com/schemas/sitemap-news/0.9>.
2. Run with the minimum input — `sitemapUrl` only:

   ```json
   {
     "sitemapUrl": "https://www.example.com/news-sitemap.xml"
   }
````

3. Read the dataset. Each row has `_kind: "article"` and fields `url`, `title`, `publicationDate`, `publication: { name, language }`, `genres[]`, `keywords[]`, `stockTickers[]`, plus `_source` (which sitemap it came from).

#### Date window

```json
{
  "sitemapUrl": "https://www.example.com/news-sitemap.xml",
  "from": "2025-01-01",
  "to": "2025-12-31",
  "maxArticles": 5000
}
```

`from` and `to` accept `YYYY-MM-DD` or full ISO 8601 timestamps. Both bounds are inclusive.

#### Full input

| Field | Type | Default | Notes |
|---|---|---|---|
| `sitemapUrl` | string (required) | — | Public HTTP(S) URL of a news sitemap or sitemap index |
| `from` | string | — | ISO date or timestamp, inclusive lower bound |
| `to` | string | — | ISO date or timestamp, inclusive upper bound |
| `includeUnparsedDate` | bool | `false` | If true, keep articles whose `<news:publication_date>` cannot be parsed |
| `maxArticles` | int | `5000` | Cap on emitted article rows |
| `timeoutSec` | int | `20` | Per-request HTTP timeout in seconds |
| `maxBytes` | int | `4000000` | Truncate sitemap body at this many bytes |

### Output

Dataset row kinds:

- `article` — one per emitted article. Carries `url`, `title`, `publicationDate`, `publication.name`, `publication.language`, `genres[]`, `keywords[]`, `stockTickers[]`, `_source`.
- `index` — sitemap index discovered, with `childCount` and `children[]`.
- `skipped` — sitemap without a `news:news` namespace, with a short reason.
- `error` — failed fetch, with HTTP status and error message.

`SUMMARY` key in key-value store:

```json
{
  "ok": true,
  "root": "https://www.example.com/news-sitemap.xml",
  "articles": 132,
  "visited": 4,
  "childCounts": [
    { "url": "https://www.example.com/news-sitemap-1.xml", "articles": 70, "inWindow": 50 },
    { "url": "https://www.example.com/news-sitemap-2.xml", "articles": 90, "inWindow": 82 }
  ]
}
```

### Pricing

This Actor is **Pay Per Event** on the Apify Store:

- `apify-actor-start` — flat per run.
- `article_extracted` — charged once per emitted article row that matches the date window.

Pricing details and per-unit USD prices are visible on the Store page. For local tests, `Actor.charge` is a no-op (no usage billed, no payout).

### Limits

- Designed for **public** Google News sitemaps. Sites that require login, cookies, or bot bypass are out of scope.
- `maxArticles` is a hard cap on emitted rows; if you hit it, raise the cap and re-run.
- `maxBytes` truncates the body of a single sitemap. Bump it for very large news sitemaps.
- Sitemap indexes are followed with a simple BFS; very deep index chains (>50 levels) are not supported.

### FAQ

**Q: Is this a scraper of article pages?**
A: No. It only reads public sitemap XML. Article bodies are never fetched.

**Q: My publisher doesn't publish a Google News sitemap — what now?**
A: This Actor will record `_kind: "skipped"` for that URL. Use the public `sitemap-delta-monitor` for generic sitemaps or `product-feed-delta-monitor` for product/feed use cases.

**Q: Why is my run returning 0 articles?**
A: Check the date window — most news sitemaps are deeply time-bounded. Try a wider `from` / `to` or remove it entirely. Also verify `<news:publication_date>` is well-formed; unparseable dates are dropped unless `includeUnparsedDate: true`.

**Q: Can I run it on a private sitemap?**
A: Only if the Actor host can reach it over plain HTTP(S) without auth. The Actor does not handle cookies, headers, login, or anti-bot challenges.

**Q: How does this differ from a generic XML feed parser?**
A: It understands the `news:` namespace and pulls publication meta, genres, keywords, and stock tickers. For arbitrary RSS/Atom/JSON feeds use `xml-feed-parser` or `rss-feed-delta-monitor`.

### Related Actors

- [`sitemap-delta-monitor`](https://apify.com/stellar_ballet_0bu/sitemap-delta-monitor) — generic sitemap URL/new/removed/lastmod deltas.
- [`sitemap-image-extractor`](https://apify.com/stellar_ballet_0bu/sitemap-image-extractor) — `image:image` namespace extraction with BFS.
- [`rss-feed-delta-monitor`](https://apify.com/stellar_ballet_0bu/rss-feed-delta-monitor) — RSS/Atom feed item deltas.
- [`xml-feed-parser`](https://apify.com/stellar_ballet_0bu/xml-feed-parser) — generic RSS/Atom detection and parsing.

### Support

Open an issue on the Actor's Apify Store page (`Report an issue` link on the right rail) or contact the developer through the Store profile.

### License

MIT — see Apify Store page for the canonical text.

# Actor input Schema

## `sitemapUrl` (type: `string`):

Public HTTP(S) URL of a Google News sitemap (news: namespace) or sitemap index pointing to one.

## `from` (type: `string`):

ISO date (YYYY-MM-DD) or full ISO timestamp. Inclusive lower bound on <news:publication_date>.

## `to` (type: `string`):

ISO date (YYYY-MM-DD) or full ISO timestamp. Inclusive upper bound on <news:publication_date>.

## `includeUnparsedDate` (type: `boolean`):

If true, articles with un-parseable <news:publication_date> are still emitted.

## `maxArticles` (type: `integer`):

Cap on the number of dataset rows emitted.

## `timeoutSec` (type: `integer`):

Abort a sitemap fetch after this many seconds.

## `maxBytes` (type: `integer`):

Truncate the sitemap body at this many bytes.

## Actor input object example

```json
{
  "sitemapUrl": "",
  "from": "",
  "to": "",
  "includeUnparsedDate": false,
  "maxArticles": 5000,
  "timeoutSec": 20,
  "maxBytes": 4000000
}
```

# Actor output Schema

## `rows` (type: `string`):

One row per emitted article (\_kind='article') with url, title, publicationDate, publication.{name,language}, genres\[], keywords\[], stockTickers\[], \_source. Plus index/skipped/error diagnostic rows.

## `summary` (type: `string`):

Run summary with ok, root, articles (emitted), visited (sitemaps walked), childCounts\[] (per-sitemap article/inWindow counts).

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("stellar_ballet_0bu/sitemap-news-sitemap-extractor").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("stellar_ballet_0bu/sitemap-news-sitemap-extractor").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call stellar_ballet_0bu/sitemap-news-sitemap-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=stellar_ballet_0bu/sitemap-news-sitemap-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Google News Sitemap Extractor",
        "description": "Fetch any public Google News sitemap (news: namespace) and emit per-article rows: title, publication date, publication name+language, genres, keywords, stock tickers. Handles sitemap indexes. Pairs with sitemap-delta-monitor as a news-only pre-filter for media monitoring and RAG news feeds.",
        "version": "0.2",
        "x-build-id": "i2XDO9wvVVWk7Frsx"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/stellar_ballet_0bu~sitemap-news-sitemap-extractor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-stellar_ballet_0bu-sitemap-news-sitemap-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/stellar_ballet_0bu~sitemap-news-sitemap-extractor/runs": {
            "post": {
                "operationId": "runs-sync-stellar_ballet_0bu-sitemap-news-sitemap-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/stellar_ballet_0bu~sitemap-news-sitemap-extractor/run-sync": {
            "post": {
                "operationId": "run-sync-stellar_ballet_0bu-sitemap-news-sitemap-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "sitemapUrl"
                ],
                "properties": {
                    "sitemapUrl": {
                        "title": "News sitemap URL",
                        "type": "string",
                        "description": "Public HTTP(S) URL of a Google News sitemap (news: namespace) or sitemap index pointing to one.",
                        "default": ""
                    },
                    "from": {
                        "title": "From date (inclusive)",
                        "type": "string",
                        "description": "ISO date (YYYY-MM-DD) or full ISO timestamp. Inclusive lower bound on <news:publication_date>.",
                        "default": ""
                    },
                    "to": {
                        "title": "To date (inclusive)",
                        "type": "string",
                        "description": "ISO date (YYYY-MM-DD) or full ISO timestamp. Inclusive upper bound on <news:publication_date>.",
                        "default": ""
                    },
                    "includeUnparsedDate": {
                        "title": "Include un-parseable dates",
                        "type": "boolean",
                        "description": "If true, articles with un-parseable <news:publication_date> are still emitted.",
                        "default": false
                    },
                    "maxArticles": {
                        "title": "Max articles to emit",
                        "type": "integer",
                        "description": "Cap on the number of dataset rows emitted.",
                        "default": 5000
                    },
                    "timeoutSec": {
                        "title": "Per-request timeout (seconds)",
                        "type": "integer",
                        "description": "Abort a sitemap fetch after this many seconds.",
                        "default": 20
                    },
                    "maxBytes": {
                        "title": "Max bytes per sitemap",
                        "type": "integer",
                        "description": "Truncate the sitemap body at this many bytes.",
                        "default": 4000000
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
