1
0
Fork 0
mirror of https://github.com/Findus23/RadioStats.git synced 2024-09-19 16:03:48 +02:00

close socket

This commit is contained in:
Lukas Winkler 2021-11-23 21:33:19 +01:00
parent 185cdc129e
commit 86ce91275e
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -1,6 +1,6 @@
import json
from websocket import create_connection
from websocket import create_connection, WebSocket
from parser import BaseFetcher
from utils import *
@ -10,12 +10,13 @@ URL = "wss://www.arabella.at/api/_socket/"
class ArabellaFetcher(BaseFetcher):
def get(self, channel):
ws = create_connection(URL, suppress_origin=True)
ws: WebSocket = create_connection(URL, suppress_origin=True)
init = ws.recv()
ws.send(json.dumps({"type": "select_channels", "channelIds": [1]}))
result = ws.recv()
ws.close()
data = json.loads(result)
tracks = [data["currentTrack"]]
tracks.extend(data["previousTracks"])