aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xml2static_rst.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/xml2static_rst.py b/xml2static_rst.py
index a4b0411..9bbe0d6 100644
--- a/xml2static_rst.py
+++ b/xml2static_rst.py
@@ -1,5 +1,17 @@
#!/usr/bin/python3
+import os.path
from xml.etree import ElementTree as ET
+ns = {'dflt': 'http://disqus.com',
+ 'xsi': 'http://disqus.com/disqus-internals',
+ 'dsq': 'http://www.w3.org/2001/XMLSchema-instance'}
+
tree = ET.parse("comments.xml")
+root = tree.getroot()
+for com_post in root.findall("dflt:post", ns):
+ if com_post.find('dflt:isSpam', ns).text == 'false':
+ print(ET.tostring(com_post, encoding='unicode', default_namespace=ns['dflt']))
+
+# if not os.path.exists('comments/'):
+# os.mkdir('comments')