Falls das mal jemand braucht, geht sicher viel einfacher aber so versteht mans vielleicht auch 😀
import requests
from pathlib import Path
from xml.sax.saxutils import escape
url='http://de1.api.radio-browser.info/json/stations?limit=100000'
json=requests.get(url).json()
with open(f"{Path.home()}/.local/share/goodvibes/stations.xml","w") as s:
s.write("<Stations>\n")
for station in json:
s.write(f' <Station>\n')
s.write(f' <uri>{escape(station['url'])}</uri>\n')
s.write(f' <name>{escape(station['name'].replace('\t','').replace('\r','').strip())}</name>\n')
s.write(f' </Station>\n')
s.write("</Stations>")