v1.5.2: filter DPG premium-artikelen via /ps/ url-path (Parool/VK/Trouw)
Deze feeds dragen geen paywall-marker (<premium>/<dpp:paid>); premium-artikelen leven onder /ps/. Gedeelde helper _is_paywalled_link voor RSS- en JSON-parsing.
This commit is contained in:
parent
cbb9c2e55d
commit
aa4f7144be
2 changed files with 13 additions and 2 deletions
|
|
@ -424,7 +424,10 @@ class RSSBot(Plugin):
|
|||
).strip()
|
||||
id = str(entry["id"])
|
||||
link = entry.get("url") or id
|
||||
return Entry(feed_id=feed_id, id=id, date=date, title=title, summary=summary, link=link)
|
||||
return Entry(
|
||||
feed_id=feed_id, id=id, date=date, title=title, summary=summary, link=link,
|
||||
paywalled=cls._is_paywalled_link(link),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _parse_rss(
|
||||
|
|
@ -445,6 +448,12 @@ class RSSBot(Plugin):
|
|||
entries = [e for e in entries if not e.paywalled]
|
||||
return feed, entries
|
||||
|
||||
@staticmethod
|
||||
def _is_paywalled_link(link: str) -> bool:
|
||||
# DPG Media premium articles live under /ps/ (Parool/VK/Trouw feeds
|
||||
# carry no paywall marker; the /ps/ path is the only reliable signal).
|
||||
return "/ps/" in (link or "")
|
||||
|
||||
@classmethod
|
||||
def _parse_rss_entry(cls, feed_id: int, entry: Any) -> Entry:
|
||||
return Entry(
|
||||
|
|
@ -470,6 +479,8 @@ class RSSBot(Plugin):
|
|||
str(getattr(entry, "premium", "")).lower() == "true"
|
||||
# DPG Media (AD/Volkskrant/Parool/Trouw): <dpp:paid>true</dpp:paid>
|
||||
or str(getattr(entry, "dpp_paid", "")).lower() == "true"
|
||||
# DPG Media /ps/ premium path (Parool/VK/Trouw carry no marker)
|
||||
or cls._is_paywalled_link(getattr(entry, "link", ""))
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
id: nl.eddydevink.rss
|
||||
version: 1.5.1
|
||||
version: 1.5.2
|
||||
modules:
|
||||
- buzzrss
|
||||
main_class: RSSBot
|
||||
|
|
|
|||
Loading…
Reference in a new issue