Fix news scraper feed discovery + summarizer startup race
Some checks failed
build-and-deploy / build (push) Failing after 4s
Some checks failed
build-and-deploy / build (push) Failing after 4s
The vendored spider only started on urls.txt lines containing '/rss' or '/feed' — but the curated urls.txt holds 200 homepages, so the crawler matched ZERO feeds and silently did nothing (2ms, 0 items). Rewrite the spider with feed autodiscovery: fetch each homepage, find its <link rel="alternate" type="application/rss+xml"> (or /feed|/rss link), parse the feed, then follow each item to extract the article. Bump DEPTH_LIMIT 1->3 (homepage -> feed -> article). Also make the summarizer resilient to booting before the app container has run alembic (docker-compose only guarantees `db` is up): add idempotent ensure_tables() mirroring the scraper's CREATE TABLE IF NOT EXISTS.
This commit is contained in:
parent
3aa6f265bb
commit
5849d72299
3 changed files with 130 additions and 28 deletions
|
|
@ -60,7 +60,8 @@ DNSCACHE_ENABLED = True
|
|||
DNSCACHE_SIZE = 20000
|
||||
DNS_TIMEOUT = 20
|
||||
DNS_RESOLVER = 'scrapy.resolver.CachingThreadedResolver'
|
||||
DEPTH_LIMIT = os.getenv('DEPTH_LIMIT', 1)
|
||||
# Depth must allow homepage(0) -> discovered feed(1) -> article(2).
|
||||
DEPTH_LIMIT = os.getenv('DEPTH_LIMIT', 3)
|
||||
|
||||
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue