Add a sanity check for articles. - zs - Zeitungsschau rss to email converter
Log
Files
Refs
LICENSE
---
commit 8d3f62e1d4d6effdb6eeb75b8f87cbbe1a05c07f
parent 3c1cf1ccaff4949d308690d30f581cba80e65593
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun, 16 Mar 2014 12:22:23 +0100

Add a sanity check for articles.

If there is no title and no text in an article, don't add it to the feed.

Diffstat:
  feed.py                             |       4 ++++

1 file changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/feed.py b/feed.py
@@ -163,6 +163,10 @@ def parse(astr):
                                 else:
                                         article["id"] = article["text"][:30]
 
+                        # sanity checks
+                        if "title" not in article and "text" not in article:
+                                continue
+
                         articles.append(article)
         feed["articles"] = articles