fHDHR_plugin_origin_distrotv/origin/__init__.py
deathbybandaid e2b068410c test
2022-01-28 07:59:46 -05:00

87 lines
2.8 KiB
Python

import json
import requests
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):
channel_list = []
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 = json.loads(chan_req.content)
print(data)
data = chan_req.json()
print(data)
response = requests.request("GET", channels_url, headers=url_headers, data=payload).content
data = json.loads(response)
print(data)
return channel_list
response = requests.request("GET", channels_url, headers=url_headers, data=payload).content
data = json.loads(response)
print(data)
topics = data['topics']
for t in topics:
title = t['title']
Type = t['type']
if Type == "live":
print(title)
return channel_list
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