aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-01-08 17:42:35 +0100
committerMatěj Cepl <mcepl@cepl.eu>2024-01-08 17:42:35 +0100
commit862ecd1e98a825a39720f9a04f1ce1fe96d8fab3 (patch)
treee49e2abfbdba9422f543d7da8fd082789227e006
parentda2e12c20265160a3a684ae92f2f0817f73e3a34 (diff)
downloaddisqus_xml2static_rst-862ecd1e98a825a39720f9a04f1ce1fe96d8fab3.tar.gz
Skip over deleted comments.
Fixes: https://todo.sr.ht/~mcepl/devel/24
-rw-r--r--comments.xml6
-rw-r--r--xml2static_rst.py4
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
</message>
<createdAt>2018-03-12T16:06:46Z</createdAt>
<isDeleted>false</isDeleted>
- <isSpam>true</isSpam>
+ <isSpam>false</isSpam>
<author>
<name>Rick Holbert</name>
<isAnonymous>false</isAnonymous>
@@ -7700,7 +7700,7 @@ xsi:schemaLocation="http://disqus.com/api/schemas/1.0/disqus.xsd http://disqus.c
</message>
<createdAt>2021-01-21T01:00:15Z</createdAt>
<isDeleted>false</isDeleted>
- <isSpam>false</isSpam>
+ <isSpam>true</isSpam>
<author>
<name>contact office</name>
<isAnonymous>false</isAnonymous>
@@ -7730,7 +7730,7 @@ xsi:schemaLocation="http://disqus.com/api/schemas/1.0/disqus.xsd http://disqus.c
</message>
<createdAt>2021-03-21T09:33:52Z</createdAt>
<isDeleted>false</isDeleted>
- <isSpam>false</isSpam>
+ <isSpam>true</isSpam>
<author>
<name>Unknown</name>
<isAnonymous>false</isAnonymous>
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']