fix(news): unwrap CDATA titles at ingest and on /api/news #62

Merged
sirius merged 1 commit from wt/t_4f334c8b into master 2026-11-17 19:57:07 +00:00
Owner

Summary

  • Unwrap a whole-title CDATA wrapper before the scraper INSERT and again on GET /api/news, so existing Excelsior rows read clean without an UPDATE.
  • <![CDATA[Hello]]>, \n <![CDATA[Hello]]>, and the live shape with trailing spaces all become Hello. A plain title and real HTML (<b>Keep</b>) are unchanged. A title that merely contains the markers is left alone.
  • Rebased onto unmerged parent wt/t_ceb74e64 (02a9a56, PR #59). This PR includes that commit. It does not reimplement health or feeds.

Premise

Live GET /api/news titles from www.excelsior.com.mx are raw <![CDATA[...]]> with surrounding whitespace (66 rows). None are entity-escaped (&lt;![CDATA[), so that form is not unwrapped.

Test plan

  • pytest tests/test_news_scraper.py tests/test_api_news.py -q — 30 passed
  • Do not merge. Known-red CI docker login 127.0.0.1:3000 is not this change.
## Summary - Unwrap a whole-title CDATA wrapper before the scraper INSERT and again on `GET /api/news`, so existing Excelsior rows read clean without an UPDATE. - `<![CDATA[Hello]]>`, `\n <![CDATA[Hello]]>`, and the live shape with trailing spaces all become `Hello`. A plain title and real HTML (`<b>Keep</b>`) are unchanged. A title that merely contains the markers is left alone. - Rebased onto unmerged parent `wt/t_ceb74e64` (`02a9a56`, PR #59). This PR includes that commit. It does not reimplement health or `feeds`. ## Premise Live `GET /api/news` titles from `www.excelsior.com.mx` are raw `<![CDATA[...]]>` with surrounding whitespace (66 rows). None are entity-escaped (`&lt;![CDATA[`), so that form is not unwrapped. ## Test plan - [x] `pytest tests/test_news_scraper.py tests/test_api_news.py -q` — 30 passed - [ ] Do not merge. Known-red CI `docker login 127.0.0.1:3000` is not this change.
/api/health articles.age_s used max(timestamp) with no future-date filter,
so rows ahead of now() reported a negative age. Use the same closed window
as the news list (timestamp <= now(); NULL timestamps are not fresh). If
every non-null timestamp is in the future, age_s is null and ok is false.

GET /api/stats keeps existing counters and adds feeds.vessels.configured
and feeds.fires.configured from non-empty api_keys values only. The stored
value is never returned.
Excelsior rows store the feed's CDATA wrapper as the title text, including
the surrounding whitespace. Strip a whole-title wrapper before insert and
again on GET /api/news so existing rows read clean without an UPDATE.
Plain titles and real HTML are unchanged.
sirius merged commit 7c77aa3103 into master 2026-11-17 19:57:07 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/osint-dashboard!62
No description provided.