From 862ecd1e98a825a39720f9a04f1ce1fe96d8fab3 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 8 Jan 2024 17:42:35 +0100 Subject: Skip over deleted comments. Fixes: https://todo.sr.ht/~mcepl/devel/24 --- comments.xml | 6 +++--- xml2static_rst.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/comments.xml b/comments.xml index ffe98a9..a6553ca 100644 --- a/comments.xml +++ b/comments.xml @@ -7498,7 +7498,7 @@ xsi:schemaLocation="http://disqus.com/api/schemas/1.0/disqus.xsd http://disqus.c 2018-03-12T16:06:46Z false - true + false Rick Holbert false @@ -7700,7 +7700,7 @@ xsi:schemaLocation="http://disqus.com/api/schemas/1.0/disqus.xsd http://disqus.c 2021-01-21T01:00:15Z false - false + true contact office false @@ -7730,7 +7730,7 @@ xsi:schemaLocation="http://disqus.com/api/schemas/1.0/disqus.xsd http://disqus.c 2021-03-21T09:33:52Z false - false + true Unknown false diff --git a/xml2static_rst.py b/xml2static_rst.py index f5c0d68..5824efc 100644 --- a/xml2static_rst.py +++ b/xml2static_rst.py @@ -23,7 +23,9 @@ for thread in root.findall("dflt:thread", ns): out = {} for com_post in root.findall("dflt:post", ns): - if com_post.find('dflt:isSpam', ns).text == 'false': + is_spam = com_post.find('dflt:isSpam', ns).text == 'true' + is_del = com_post.find('dflt:isDeleted', ns).text == 'true' + if not (is_spam or is_del): thread = com_post.find('dflt:thread', ns) thread_id = thread.attrib[f"{{{ns['xsi']}}}id"] blurb = threads[thread_id]['blurb'] -- cgit