.dotfiles/.local/bin/cron/openfm-update-stations
2021-05-24 10:34:06 +02:00

18 lines
419 B
Python
Executable File

#!/usr/bin/python3
import requests
import json
response = json.loads(
requests.get("https://open.fm/radio/api/v2/ofm/stations_slug.json").text
)
dict_ = {}
for channel in response["channels"]:
id_ = channel["instance_id"]
name = channel["name"]
dict_[name] = id_
with open("/home/samedamci/.config/radio/openfm_channels.json", "w") as f:
f.write(json.dumps(dict_, indent=2, ensure_ascii=False))