blob: 3471ef97bf7c7c858aa5dfed4f26c4545a3de64a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#! /usr/bin/python3
"""
A script to generate html from the rss feed
"""
import xml.etree.ElementTree as et
def main():
tree = et.parse("feed.xml")
root = tree.getroot()
channel = root[0]
template = ""
# Open html template
with open("template.html", "r") as fp:
template = fp.read()
# Get articles from rss
for item in channel.findall("item"):
article = item.find("description").text
# Remove article tags.
article = article[article.find("<article>")+9::]
article = article[:article.find("</article>"):]
print(article)
if __name__ == "__main__":
main()
|