80 lines
2.8 KiB
Python
80 lines
2.8 KiB
Python
|
|
|
|
class Plugin_OBJ():
|
|
|
|
def __init__(self, plugin_utils):
|
|
self.plugin_utils = plugin_utils
|
|
|
|
@property
|
|
def tuners(self):
|
|
return self.plugin_utils.config.dict["ustvgo"]["tuners"]
|
|
|
|
@property
|
|
def stream_method(self):
|
|
return self.plugin_utils.config.dict["ustvgo"]["stream_method"]
|
|
|
|
def get_channels(self):
|
|
|
|
channels_url = "https://tv.jsrdn.com/tv_v5/getfeed.php"
|
|
payload = {}
|
|
url_headers = {
|
|
'authority': 'tv.jsrdn.com',
|
|
'accept': 'application/json, text/javascript, */*; q=0.01',
|
|
'sec-fetch-dest': 'empty',
|
|
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36',
|
|
'origin': 'https://www.distro.tv',
|
|
'sec-fetch-site': 'cross-site',
|
|
'sec-fetch-mode': 'cors',
|
|
'referer': 'https://www.distro.tv/live',
|
|
'accept-language': 'en-US,en;q=0.9'
|
|
}
|
|
chan_req = self.plugin_utils.web.session.get(channels_url, headers=url_headers, data=payload)
|
|
entries = chan_req.json()
|
|
print(entries)
|
|
return
|
|
|
|
"""
|
|
response = requests.request("GET", url, headers=headers, data = payload).content
|
|
|
|
data = json.loads(response)
|
|
topics = data['topics']
|
|
for t in topics:
|
|
title = t['title']
|
|
Type = t['type']
|
|
if Type == "live":
|
|
addDir(title,title,3,addon_icon,addon_fanart,title)
|
|
"""
|
|
|
|
channels_url = "https://ustvgo.tv/tvguide/national.json"
|
|
|
|
chan_req = self.plugin_utils.web.session.get(channels_url)
|
|
entries = chan_req.json()
|
|
|
|
channel_list = []
|
|
chan_number_index = 0
|
|
for channel_dict in entries:
|
|
chan_number_index += 1
|
|
|
|
clean_station_item = {
|
|
"name": channel_dict["channel"]["fullName"],
|
|
"callsign": channel_dict["channel"]["name"],
|
|
"number": chan_number_index,
|
|
"id": channel_dict["channel"]["sourceId"],
|
|
"thumbnail": "https://static.streamlive.to/images/tv/%s.png" % channel_dict["channel"]["name"].lower().replace("&", "")
|
|
}
|
|
channel_list.append(clean_station_item)
|
|
return channel_list
|
|
|
|
def get_channel_stream(self, chandict, stream_args):
|
|
|
|
streamurl = self.get_ustvgo_stream(chandict["callsign"])
|
|
|
|
stream_info = {"url": streamurl}
|
|
|
|
return stream_info
|
|
|
|
def get_ustvgo_stream(self, chancode):
|
|
data = {'stream': chancode}
|
|
stream_url = self.plugin_utils.web.session.post('https://ustvgo.tv/data.php', data=data).text
|
|
return stream_url
|