mirror of
https://github.com/Findus23/RadioStats.git
synced 2024-09-19 16:03:48 +02:00
close socket
This commit is contained in:
parent
185cdc129e
commit
86ce91275e
1 changed files with 3 additions and 2 deletions
|
@ -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"])
|
||||
|
|
Loading…
Reference in a new issue