From ad03cd96ce8916103c46b74f79ee5e71a41c2591 Mon Sep 17 00:00:00 2001 From: Jared Bell Date: Tue, 15 Sep 2026 16:45:06 +0000 Subject: [PATCH] Add SSR/embedded-JSON extraction and restore Forbes services/ssr.py walks JSON-LD and Next.js __NEXT_DATA__ for article-like objects (headline, or title+url, or name with article signals), recovering JS-rendered sites without a browser. prepare_headlines favors embedded JSON over regex link scraping. Forbes is re-added as a live proof. --- README.md | 12 +++- resources/sources.txt | 3 +- services/headlines.py | 22 ++++++-- services/ssr.py | 125 ++++++++++++++++++++++++++++++++++++++++++ tests/test_ssr.py | 67 ++++++++++++++++++++++ 5 files changed, 220 insertions(+), 9 deletions(-) create mode 100644 services/ssr.py create mode 100644 tests/test_ssr.py diff --git a/README.md b/README.md index 4725e1c..f6a95a4 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,10 @@ question: *which stories are multiple independent sources reporting right now?* ## How it works 1. **Load** source URLs and stopwords from `resources/`. -2. **Fetch** each source. RSS/Atom feeds are parsed as structured XML (titles and - publication timestamps); HTML pages are scraped for ``/`` text, - associating each headline with the nearest ``/`` text, associating each headline with + the nearest `