Daily Hot Topics
Overview
This skill answers "what is hot today?" in a single call. It fetches a ranked hot-topic list from public, keyless hot-list REST endpoints (read-only over HTTPS), normalises every provider into one shape, and renders a readable list.
- One run, one ranked list — a single execution returns today's hot topics
with rank / title / hot value / source, up to
--topentries. - Multiple providers, ordered degradation — the default chain tries several
public sources in order; the first success wins.
--sourcepins a preferred provider while keeping the remaining providers as fallbacks. - Bundled offline fallback — if the network is unavailable or every provider fails, the skill falls back to a bundled sample dataset and clearly labels it as sample data (non-real-time), so the command still exits 0 and stays readable instead of crashing.
- Readable by default, machine-readable on demand — Markdown (default), plain text, and JSON output; results can be written to a file.
- Self-contained — pure Python 3 standard library (only
urllib), zero third-party dependencies, no credentials.
Prerequisites
- Python 3.8+ available as
python3(orpython) onPATH. - Outbound HTTPS to the public hot-list endpoints is optional: without it
the skill degrades to the bundled
scripts/sample_data.jsonand still succeeds. - No Huawei Cloud credentials, CLI (KooCLI), SDK, or AK/SK are needed; this skill never accesses Huawei Cloud resources.
scripts/sample_data.jsonships with the skill and is used only as the final fallback.
Workflow
- Resolve the provider chain —
resolve_chain(source)returns the ordered list of providers to try: the default chain forauto, or the requested source first followed by the remaining default providers. - Fetch each provider —
fetch_source(name, timeout, retries)performs a read-only HTTPS GET with a bounded timeout and a small retry budget, parses the JSON, validates the envelope, and normalises the records. - Normalise —
normalize(records, label)maps heterogeneous fields into{rank, title, hot, source, url}, skipping records without a usable title. - Degrade —
fetch(...)walks the chain; the first provider that returns a non-empty list wins. If all fail (or--offlineis set), it loads the bundled sample dataset and marks the result as sample data, collecting a warning trail. - Render —
render_markdown()/render_text()/render_json()turn the result into readable output, constrained to--topentries. - Emit — the result goes to standard output, or to a file when
--outputis given.
Core Commands
# Default: today's hot list as a Markdown table (top 10)
python3 scripts/fetch_hot_topics.py
# Plain text, only the top 5
python3 scripts/fetch_hot_topics.py --format text --top 5
# Machine-readable JSON (parseable), top 3
python3 scripts/fetch_hot_topics.py --format json --top 3
# Pin a preferred provider (falls back to the other providers, then sample data)
python3 scripts/fetch_hot_topics.py --source zhihu --top 20
# Skip the network entirely and use the bundled sample dataset
python3 scripts/fetch_hot_topics.py --offline
# List the available providers
python3 scripts/fetch_hot_topics.py --list-sources
# Write the result to a file, with a longer timeout
python3 scripts/fetch_hot_topics.py --format markdown --timeout 30 --output hot.md
# Run the bundled unit tests (offline; HTTP is mocked)
python3 -m unittest discover -s tests -v
The command-line entry point is scripts/fetch_hot_topics.py. The bundled
scripts/sample_data.json is what the offline fallback reads by default.
Parameter Confirmation
| Parameter | Required | Description | Default |
|---|---|---|---|
--top |
No | Number of entries to show | 10 |
--source |
No | Preferred provider: auto, weibo, zhihu, douyin, vvhan |
auto |
--format |
No | Output format: markdown, text, or json |
markdown |
--output |
No | Write the result to a file instead of stdout | stdout |
--timeout |
No | Per-request timeout in seconds | 20 |
--retries |
No | Retry attempts per provider | 2 |
--offline |
No | Skip the network and use the bundled sample dataset | off |
--list-sources |
No | Print the available providers and exit | off |
Reference Documents
| Document | Description |
|---|---|
| references/usage-guide.md | Command recipes, provider chain, offline behaviour, extending providers |
| references/verification-method.md | How the skill is verified (offline unit tests + live read-only spot checks) |
| references/acceptance-criteria.md | Acceptance criteria and out-of-scope items |
| references/dataflow-diagram.md | Mermaid data flow diagram |
| references/iam-policies.md | Permission notes (none required) |
Notes
- The skill is read-only: it fetches public hot lists over HTTPS and writes
only to standard output or a user-chosen
--outputfile. It never touches a cloud resource and never persists fetched data. - Degradation is explicit: when the network or providers fail, the fallback result is flagged as sample data and a warning trail is printed, so a sample list is never mistaken for a live ranking.
- The exit code is
0on success (including fallback to sample data); a non-zero code is returned only for invalid arguments or when--outputcannot be written. - Third-party public endpoints are not under our control; providers are easy to
replace or extend by editing the
PROVIDERSregistry in the script.
