v1.3.0: paywall-filter (Telegraaf/NHD premium) + staking-fix
- exclude_paywalled config (default true): verwijdert feedparser-entries met <premium>true</premium> vóór opslag (Telegraaf en NHD markeren dit; AD/ Parool/Trouw/VK/NRC niet) - v8-migratie: entry.paywalled BOOLEAN - staking-fix (v1.2.3): losse 'staking/stakingen' uit filter; alleen ov- specifiek: ov-staking, bus/tram/metro/spoor/conducteurs-staking, 'openbaar vervoer' - config-proof: match_filter altijd enkelregelig YAML
This commit is contained in:
parent
79a8d0bc71
commit
5d75f490fc
5 changed files with 27 additions and 11 deletions
|
|
@ -91,6 +91,7 @@ class Entry:
|
|||
title: str
|
||||
summary: str
|
||||
link: str
|
||||
paywalled: bool = False
|
||||
|
||||
def __attrs_post_init__(self):
|
||||
if self.date.tzinfo is None:
|
||||
|
|
@ -161,14 +162,14 @@ class DBManager:
|
|||
for entry in entries:
|
||||
entry.feed_id = override_feed_id
|
||||
records = [attr.astuple(entry) for entry in entries]
|
||||
columns = ("feed_id", "id", "date", "title", "summary", "link")
|
||||
columns = ("feed_id", "id", "date", "title", "summary", "link", "paywalled")
|
||||
async with self.db.acquire() as conn:
|
||||
if self.db.scheme == Scheme.POSTGRES:
|
||||
await conn.copy_records_to_table("entry", records=records, columns=columns)
|
||||
else:
|
||||
q = (
|
||||
"INSERT INTO entry (feed_id, id, date, title, summary, link) "
|
||||
"VALUES ($1, $2, $3, $4, $5, $6)"
|
||||
"INSERT INTO entry (feed_id, id, date, title, summary, link, paywalled) "
|
||||
"VALUES ($1, $2, $3, $4, $5, $6, $7)"
|
||||
)
|
||||
await conn.executemany(q, records)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue