# Sources

What Herald reads, how to add a source, the plugin types, optional API credentials and how
sources that stop working are handled.

## The catalog

Sources live in `sources/*.yaml`, grouped by region and topic. The catalog includes:
- Brazilian, US and European outlets (national papers, broadcasters, business and tech press);
- Brazilian regional papers and portals from every macro-region, plus state governments' news
  agencies and state courts (TJs, TCEs), tagged with their `state`;
- Asia-Pacific English-language editions from China, Hong Kong, Japan, India, Korea, Taiwan,
  Southeast Asia and Australia, plus the region's central banks (`sources/apac.yaml`; paywalled
  outlets such as Nikkei Asia, SCMP and AFR are used for headline and lede only);
- Oceania: Australian national and state press, business and ASX news, the RBA and government
  releases, New Zealand papers, broadcasters and Beehive releases, and Pacific outlets and
  official sources from Fiji, Samoa, Tonga and Solomon Islands (`sources/oceania.yaml`; the
  Australian and New Zealand entries of `sources/apac.yaml` feed it too);
- Middle East and Africa English-language outlets from the Gulf, Israel, Iran, Turkey, Egypt,
  South Africa, Nigeria and Kenya, fintech and startup press, and the Central Bank of Kenya
  (`sources/mea.yaml`; paywalled outlets such as Haaretz and Al-Monitor are used for headline and
  lede only);
- Western Balkans, Greece and Cyprus: national press in Greek, Serbian, Bosnian, Macedonian and
  Albanian, English-language outlets, business press and the official feeds that exist (central
  bank, statistics office, government) for Serbia, Bosnia and Herzegovina, Montenegro, North
  Macedonia, Albania, Kosovo, Greece and Cyprus, routed to the `eu-*` profiles
  (`sources/europe-southeast.yaml`; Kathimerini and Phileleftheros are headline and lede only);
- Spanish, Portuguese, Andorran, Irish and British national and regional press (Spanish,
  Catalan, European Portuguese and English), plus ONS, the FCA, HM Treasury,
  GOV.UK and the Portuguese government (`sources/europe-iberia-uk.yaml`; paywalled outlets such as
  New Statesman are used for headline and lede only);
- French-, Italian-, German- and Dutch-language press, central banks, statistics offices and
  government releases from France, Belgium, Luxembourg, Switzerland, Monaco, Italy, Malta, San
  Marino and the Vatican (`sources/europe-fr-it.yaml`; paywalled outlets such as Le Temps,
  Corriere della Sera and Tages-Anzeiger are used for headline and lede only);
- Central and Eastern European national press, business outlets, central banks and statistics
  offices from Poland, Czechia, Slovakia, Hungary, Romania, Bulgaria, Slovenia, Croatia, Ukraine
  and Moldova, plus independent Belarusian outlets in exile, in their own languages
  (`sources/europe-central-east.yaml`, routed to the `eu-*` profiles);
- Nordic and Baltic outlets from Denmark, Sweden, Norway, Finland, Iceland, Estonia, Latvia and
  Lithuania in the local languages plus English editions, with central banks and statistics
  offices where a feed exists (`sources/europe-nordic-baltic.yaml`, routed to the `eu-*`
  profiles; paywalled papers such as Dagens Nyheter, Aftenposten and Helsingin Sanomat are used
  for headline and lede only);
- German and Dutch-language press from Germany, Austria, Liechtenstein and the Netherlands, plus
  the Bundesbank, DNB, CBS, FMA Austria and government releases (`sources/europe-de-nl.yaml`;
  paywalled outlets such as manager magazin, Die Presse and De Telegraaf are used for headline
  and lede only);
- Canadian English and French outlets: national papers and broadcasters, Quebec and provincial
  majors, business and tech press, plus the Bank of Canada, Statistics Canada and federal and
  provincial government releases (`sources/canada.yaml`; paywalled outlets such as The Globe and
  Mail and Le Devoir are used for headline and lede only);
- regional tech and startup press: European national tech outlets in local languages, Latin
  American, Canadian, Australian and New Zealand tech and startup outlets, routed to the tech and
  startup profiles, Australian and New Zealand startup press also to `oceania-economy`
  (`sources/tech-regional.yaml`; InnovationAus is headline and lede only);
- official data from central banks, statistics offices and regulators;
- Latin American papers of record, economic press, central banks and statistics offices of
  Argentina, Mexico, Chile, Colombia, Peru and Uruguay, plus regional outlets
  (`sources/latam.yaml`);
- more Mexican outlets and official sources, plus national press and official sources from
  Central America (Guatemala, Belize, Honduras, El Salvador, Nicaragua, Costa Rica, Panama) and
  the Caribbean (Cuba, Dominican Republic, Puerto Rico, Jamaica, Haiti, Trinidad and Tobago),
  routed to the `latam-*` profiles (`sources/latam-central.yaml`);
- the rest of South America: Venezuela, Ecuador, Bolivia, Paraguay, Guyana (English)
  and Suriname (Dutch), with more Argentine, Chilean, Colombian, Peruvian and Uruguayan
  outlets and the official sources that publish a feed, routed to the `latam-*` profiles
  (`sources/latam-south.yaml`);
- sports outlets from Brazil, the US and Europe (`sources/sports.yaml`), plus Latin America,
  Canada, Australia and New Zealand, European national leagues, tennis, cycling and motorsport
  (`sources/sports-world.yaml`);
- science, health, climate and energy, culture and startup/VC outlets, Brazilian and global
  (`sources/topics.yaml`);
- communities.

Live status for each source is in [`docs/sources-report.md`](sources-report.md).

## Adding a source

**The quick way: give Herald the site.**

```bash
uv run herald sources add https://www.nexojornal.com.br https://example.com/feed/
```

For each URL, Herald:
1. finds the feed (the URL itself, the page's RSS autodiscovery, then common paths such as
   `/feed`);
2. checks robots.txt and refuses sources that disallow it or are already in the catalog;
3. reads the latest headlines.

The configured AI provider (`ai.scoring`) then proposes:
- the name and country;
- the `tier`;
- `paywall`;
- the `route` (only category ids that exist, otherwise `auto`);
- the catalog file.

You see the entry and confirm before it is appended. `--yes` skips the question and `--file`
picks the catalog file. Without an AI provider the entry gets defaults from the feed to edit by
hand. A `paywall: true` suggestion carries a note to verify it.

**By hand:** put an entry in the file that fits:

```yaml
- id: my-outlet
  name: My Outlet
  site: https://myoutlet.com.br
  type: rss
  feed_url: https://myoutlet.com.br/feed/   # optional: the validator can discover it from `site`
  status: unchecked
  tier: 2                       # 1 always fetched, 2 capped harder, 3 disabled by default
  paywall: false                # true: headline + lede + metadata only, never the article page
  lang: pt-BR
  state: RS                     # optional: Brazilian UF, for `sources.states`
  route: [br-markets, br-economy]   # fixed profile, list of candidates, or "auto"
```

Then validate it:

```bash
uv run herald sources validate --only my-outlet
```

`--only` takes a comma-separated list (`--only my-outlet,other-outlet`) and can be repeated. An id
that is not in the catalog stops the command with an error naming it (exit 2) before anything is
fetched.

The validator does three things:
- finds the feed when only `site` is set;
- checks that the feed is alive and recent;
- writes the `status` (`ok`, `no_feed`, `dead`, `scrape_needed`, `blocked`, `unchecked`) and
  updates `docs/sources-report.md`.

Only `ok` and `unchecked` sources within `sources.max_tier` are fetched.

Results are saved in place: only the fields the validator owns (`status`, `feed_url`,
`checked_at`, `last_item_at`, its `note`) change, and comments, key order and quoting stay as you
wrote them. A `note` is replaced only when the status changes or the entry has none, so a note
you wrote on a source whose status holds is kept. Entries marked `pinned: true` keep their
researched status and note (only `checked_at` moves); when a pinned source validates `ok` again,
the command lists it so you can review the note and remove `pinned` by hand.

When a catalog file or the report cannot be written, as in the published Docker image where
`/app/sources` is read-only, the command still checks and logs every source, prints
`results not saved to <file>` (or `report not saved to <file>`) and exits 0. Mount your own
`sources/` folder, or run from a checkout, to keep the results.

**Central banks and statistics offices without a feed.** Many official sites publish a feed that
autodiscovery misses: an RSS index page (`/rss-feeds/`, `rss_eng`), English-language channels or
a press-release channel. Check those first; Norges Bank, the CNB, GUS, KSH, INE Portugal and
Statistics Iceland were found this way. The rest stay `scrape_needed` or `no_feed` with a note.
Herald does not scrape them by default: a bank's rate decisions still reach the briefing's
Upcoming section through the `central_banks` calendar (euro-area national banks through `ecb`),
and the offices with an official iCalendar through their calendar providers (see
[Configuration](configuration.md#tuning-the-content)).

## Sources in any language

A source can be in any language: set its `lang` (`es`, `fr`, `de`, `pl`, `sv`, ...) and the
briefing is still written in `output.languages`. Nothing in the pipeline ranks it lower for not
being Portuguese or English:
- the default embedding model is multilingual, so the pre-filter matches the item to a category
  by meaning; category keywords only boost items in the languages they are written in
  (`keyword_languages` in the profile front matter) and a miss does not count against other
  languages;
- the same story in two languages clusters together when the headlines are close translations
  sharing names or numbers, and the LLM merge step groups looser cross-language coverage;
- the scoring prompt judges what an item reports, never its language.

Without embeddings (`embeddings.provider: "none"`) only keywords route items, so give a
foreign-language source a fixed `route`.

## Follow your state

Regional and state-level sources carry a `state` tag (a Brazilian UF
such as `RS`). Set `sources.states` in config.json, for example `"states": ["RS", "SC"]`, and
Herald fetches the tagged sources of those states (including tier 3 local portals) and skips
the tagged sources of every other state. Untagged sources are not affected. The default, `[]`,
keeps every state within `max_tier`.

## Sources that stop working

Some feeds fail now and then (rate limits, timeouts); that is
noise. `herald sources health` reads the outcome of each source in the last runs and sorts them
into healthy, flaky (some errors), silent (never any items) and dead (an error in each of the last
5 runs). The run report names dead sources on a `health` line. `--apply` marks them `dead` in the
catalog, so they stop being fetched; pinned entries are left alone, and `herald sources validate`
brings a source back once it works again.

## Plugins and options

**Useful RSS options** (under `options:`):
- `feeds`: extra feed URLs for the same source;
- `timezone`: for dates without an offset;
- `allow_undated`: for feeds without item dates.

**Sites without a feed** use `html_list` with CSS selectors:

```yaml
  type: html_list
  options:
    list_url: https://portal.febraban.org.br/
    item: article.fbr-card
    title: .fbr-card__title
    date: time.fbr-card__date
    date_format: '%d/%m/%Y'
```

**Plugin types:**
- Feeds and pages: `rss` (with full-text extraction for non-paywalled sources), `html_list`.
- Communities: `hackernews`, `lobsters`, `reddit` (official OAuth API), `github_trending`,
  `github_releases`, `google_news`, `gdelt`.
- Official data: `bcb_focus`, `bcb_sgs`, `bcb_copom`, `bcb_normativos`, `ibge_releases`,
  `camara`, `senado`, `cvm_filings`, `sec_edgar`, `fred`, `federal_register`, `congress`.

Herald respects robots.txt and rate limits on every redirect hop, and sends a descriptive
User-Agent. It never bypasses paywalls. Sources that refuse automated access are marked `blocked`
and left alone.

GDELT asks for at most one request every 5 seconds. All `gdelt` sources of a run share one
request slot: requests go out one at a time, 6 seconds apart, the robots.txt check takes a turn of
its own, and a 429 waits for its `Retry-After` before a bounded retry. GDELT also throttles some
addresses (busy or shared servers) below that limit; there the `gdelt` sources keep failing with
HTTP 429, and `herald sources health` eventually reports them dead.

## Optional API credentials

| Variable | Unlocks |
|---|---|
| `FRED_API_KEY` | FRED series, plus BLS/BEA release dates in the upcoming section |
| `CONGRESS_API_KEY` | US Congress bills |
| `SEC_USER_AGENT` | SEC 8-K filings (must contain your contact details, as SEC requires) |
| `REDDIT_CLIENT_ID`, `REDDIT_CLIENT_SECRET` | Reddit via the official API |
| `GITHUB_TOKEN` | Higher GitHub API rate limits |

Without them the affected sources are skipped, which is not an error. The log has one line per
plugin and reason:

```text
reddit: 6 sources skipped, missing configuration: REDDIT_CLIENT_ID/REDDIT_CLIENT_SECRET not set
```

The run report lists them and the reason under `skipped sources (not errors)`, and
`herald sources health` never counts them or marks them dead.
