12 lines
337 B
Python
12 lines
337 B
Python
import pathlib
|
|
import xml.etree.ElementTree
|
|
|
|
|
|
def parse_opml(opml: str) -> list[str]:
|
|
f = xml.etree.ElementTree.fromstring(opml)
|
|
return [e.attrib["xmlUrl"] for e in f.iterfind(".//*[@xmlUrl]")]
|
|
|
|
|
|
def load_opml(path: pathlib.Path) -> list[str]:
|
|
with open(path, "r", encoding="utf-8") as f:
|
|
return parse_opml(f.read())
|