mirror of
https://github.com/Findus23/RadioStats.git
synced 2024-09-19 16:03:48 +02:00
17 lines
565 B
Python
17 lines
565 B
Python
from parser import BaseFetcher
|
|
from utils import *
|
|
|
|
|
|
class OrfFetcher(BaseFetcher):
|
|
def get(self, channel):
|
|
r = careful_fetch(f"https://audioapi.orf.at/{channel.shortname}/json/4.0/live")
|
|
r.raise_for_status()
|
|
for song in r.json()[0]["items"]:
|
|
time = datetime.fromtimestamp(song["start"] / 1000)
|
|
try:
|
|
artist = song["interpreter"]
|
|
title = song["title"]
|
|
except KeyError:
|
|
print("not a song")
|
|
continue
|
|
yield (time, artist, title)
|