#!/usr/bin/env python3 from datetime import datetime import lxml.html from lxml import etree document = lxml.html.parse("static_tmp/releases.html").getroot() releases = document.body.cssselect("#changelog article") updated = None entries = [] for release in releases: title = release.attrib["id"] time = datetime.strptime(title, "%Y.%m.%d.%H").isoformat() + "Z" if updated is None: updated = time content = [etree.tostring(e).decode() for e in release.getchildren()[1:]] entries.append(f""" https://grapheneos.org/releases#{title} {title} {time} {time}
{"".join(content)}
""") feed = f""" https://grapheneos.org/releases#changelog https://grapheneos.org/favicon.ico GrapheneOS changelog {updated} GrapheneOS contact@grapheneos.org https://grapheneos.org/ {"".join(entries)} """ with open("static_tmp/releases.atom", "w") as f: f.write(feed)