> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# Add WeChat and Xiaohongshu research feeds to TrendRadar

> Configure two curated RSS feeds and verify retrieval, filtering and reporting in TrendRadar.

Add two subscriptions to `rss.feeds` in TrendRadar's `config/config.yaml`: one feed for new WeChat articles and one feed for Xiaohongshu leads. Fetch account listings or search results with BeatAPI, generate an RSS file from the selected items (for Xiaohongshu with `make_feed.py` below), and publish each RSS file at an HTTPS URL that TrendRadar can reach. Add the first feed and get one sample item into the TrendRadar digest before adding the second feed.

## Prepare two reachable feeds

* **WeChat**: Build a candidate list with [incremental article checks](/guides/wechat-incremental-articles). For selected articles with existing text records, reuse the [local RSS generator](/guides/wechat-to-rss).
* **Xiaohongshu**: Get note IDs, titles and search excerpts with the [search export](/guides/xiaohongshu-notes-research). Select the notes, and add an independently verified post link to each selected record. Fetch note details only when the saved material falls short.

A title-and-link feed reuses the saved material; no article bodies are needed. In your RSS publishing step:

1. Create one XML file per source.
2. Give each item a real `title` and `link` plus a stable `guid`: the account and article key for WeChat, the note ID for Xiaohongshu, with a distinct prefix per source. A repeated observation of the same post keeps the same `guid`.
3. Put any saved excerpt in `description`.
4. Write `pubDate` in RSS date format only when you know the real publication time.
5. Verify one real item, then serve the XML files at HTTPS URLs reachable from the TrendRadar runtime.

## Generate Xiaohongshu RSS from the reviewed shortlist

Save the reviewed items in `notes.json`. Set `link` to the feed homepage and each `items[].url` to a verified original post. Provide a timezone-aware ISO 8601 `published_at` when the publication time is known, and omit `published_at` otherwise. Replace the example title, URLs and ID.

```json
{
  "title": "Coffee notes",
  "link": "https://feeds.example.com/",
  "description": "Reviewed Xiaohongshu research leads",
  "items": [
    {
      "id": "xiaohongshu:example-note",
      "title": "Coffee equipment cleaning",
      "url": "https://example.com/original-note",
      "excerpt": "Saved excerpt"
    }
  ]
}
```

```python
import json
import sys
import tempfile
from datetime import datetime
from email.utils import format_datetime
from pathlib import Path
from urllib.parse import urlsplit
from xml.etree import ElementTree as ET

source, target = map(Path, sys.argv[1:])
data = json.loads(source.read_text(encoding="utf-8"))
rss = ET.Element("rss", version="2.0")
channel = ET.SubElement(rss, "channel")
for field in ("title", "link", "description"):
    value = data[field].strip()
    if not value:
        raise SystemExit(f"Missing channel {field}")
    ET.SubElement(channel, field).text = value

seen = set()
for row in data["items"]:
    item_id, title, link = (row[key].strip() for key in ("id", "title", "url"))
    url = urlsplit(link)
    if not item_id or not title or url.scheme != "https" or not url.hostname or url.username:
        raise SystemExit("Provide a stable ID, title and verified HTTPS link")
    if item_id in seen:
        raise SystemExit(f"Duplicate item ID: {item_id}")
    seen.add(item_id)
    item = ET.SubElement(channel, "item")
    ET.SubElement(item, "title").text = title
    ET.SubElement(item, "link").text = link
    ET.SubElement(item, "guid", isPermaLink="false").text = item_id
    if row.get("excerpt"):
        ET.SubElement(item, "description").text = row["excerpt"]
    if row.get("published_at"):
        published = datetime.fromisoformat(row["published_at"].replace("Z", "+00:00"))
        if published.utcoffset() is None:
            raise SystemExit(f"Missing timezone for {item_id}")
        ET.SubElement(item, "pubDate").text = format_datetime(published)

if not seen:
    raise SystemExit("Empty feed; previous file kept")
xml = ET.tostring(rss, encoding="utf-8", xml_declaration=True)
ET.fromstring(xml)
with tempfile.NamedTemporaryFile(dir=target.parent, delete=False) as temp:
    temporary_path = Path(temp.name)
try:
    temporary_path.write_bytes(xml)
    temporary_path.replace(target)
finally:
    temporary_path.unlink(missing_ok=True)
```

Save the script as `make_feed.py` and run `python3 make_feed.py notes.json xiaohongshu.xml` with Python 3.8 or later. `make_feed.py` replaces `xiaohongshu.xml` only after the new XML parses. Empty input, duplicate IDs and invalid dates leave the previous `xiaohongshu.xml` intact; correct `notes.json` and rerun `make_feed.py` locally.

## Add the feeds in TrendRadar

Merge the two entries below into `rss.feeds` in your deployment's `config/config.yaml`. Keep the other feeds already in `rss.feeds`, and replace the example URLs. Inside a container, `localhost` refers to the TrendRadar container itself, not to the host.

```yaml
rss:
  enabled: true
  feeds:
    - id: wechat-research
      name: WeChat research
      url: https://feeds.example.com/wechat.xml
    - id: xiaohongshu-research
      name: Xiaohongshu research
      url: https://feeds.example.com/xiaohongshu.xml
```

1. From the TrendRadar runtime, verify that each feed URL can be fetched.
2. Run one TrendRadar cycle and inspect the retrieval log and the report.
3. In keyword mode, add a term the test item should match to `config/frequency_words.txt`.
4. Confirm that `display.regions.rss` is enabled and that `display.region_order` includes `rss`, then check the age filter.
5. Schedule the feed update so that feed generation finishes before TrendRadar fetches.

## Diagnose a missing report item

| What happened                                          | Check first                                                      |
| ------------------------------------------------------ | ---------------------------------------------------------------- |
| Retrieval fails                                        | Reachability, authorization and XML parsing                      |
| Feed is fetched but the item is absent from the report | Keywords, RSS region, actual publication time and `max_age_days` |
| The same item keeps reappearing                        | Source ID, `guid`, notification mode and repeat runs             |
| The displayed date is wrong                            | Source time units, timezone and accidental use of retrieval time |

For example, for a digest about “cold brew,” put two same-day items in a test feed: “Cold brew coffee for beginners” and “How to clean an oven.” With keyword filtering enabled and “cold brew” configured, the retrieval log should show the test feed fetched successfully, and the digest should show “Cold brew coffee for beginners” with the original link. If both items are in the test feed but the coffee item is absent from the digest, check the keyword and display settings. Then publish the coffee item again with the same `guid`, and confirm that the notification mode treats the coffee item as an existing item.

When a run has no approved notes, `make_feed.py` keeps the previous XML. Log the feed name, run time and result, for example “Xiaohongshu shortlist, Tuesday 09:00, no approved notes, Monday’s file kept.” If the log shows a new file but TrendRadar still sees Monday’s items, check from the TrendRadar runtime which file the feed URL actually serves. When editing a title, keep the same note ID and `guid`.

Checking one page for each of five WeChat accounts and three Xiaohongshu keywords takes eight data requests per day. Regenerating the XML from saved records requires no new lookup. Extra pages and note details are billed per request. [BeatAPI pricing](https://beatapi.io/pricing)

[TrendRadar RSS config example](https://github.com/sansan0/TrendRadar/blob/master/config/config.en.yaml) · [TrendRadar feeds and keyword filters](https://github.com/sansan0/TrendRadar/blob/master/README-EN.md) · [RSS 2.0 specification](https://www.rssboard.org/rss-specification)