Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Tento skript vám pomocí webového serveru zpřístupní cestu k vaším streamům v rámci lokální sítě.

Podporované poskytovatelé internetové televize:<br>
O2TV, T-mobile TV GO, SledovaniTV.cz, Telly, 4NET.TV, Kuki TV, Magio GO, SledovanieTV.sk, REBIT.tv, Orange TV, Sweet TV, Touch TV, O2 TV SK, Antik SK
O2TV, T-mobile TV GO, SledovaniTV.cz, Telly, 4NET.TV, Kuki TV, Magio GO, SledovanieTV.sk, REBIT.tv, Orange TV, Sweet TV, Touch TV, O2 TV SK, Antik SK, Eri TV

<p>

Expand Down
30 changes: 30 additions & 0 deletions providers/eritv/eritv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#-*-coding:utf8;-*-

import requests, json, os


channels = {}
try:
with open("./providers/eritv/eritv_token.json", 'r') as openfile:
data = json.load(openfile)
token = data["token"]
except:
token = ""
if token != "":
data = {"device_token": token}
req = requests.post("https://backoffice.4net.tv/api/device/getSources/", json = data, headers = {"Content-Type": "application/json"}).json()
if req["success"] == True:
for c in req["channels"]:
channels[c["id"]] = ((c["name"], c["content_sources"][0]["stream_profile_urls"]["adaptive"]))


def get_catchup(id, utc, utcend):
url = "http://sledovanietv.sk/download/noAccess-cs.m3u8"
try:
req = requests.get("https://backoffice.4net.tv/contentd/api/device/getContent?device_token=" + token + "&channel_id=" + id + "&start=" + utc + "&end=" + utcend + "&broadcast_offset=").json()
if req["success"] == True:
url = req["stream_uri"]
except:
url = "http://sledovanietv.sk/download/noAccess-cs.m3u8"
return url

34 changes: 34 additions & 0 deletions providers/eritv/login.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#-*-coding:utf8;-*-

import requests, json, os, uuid, re, sys


# párovací kód
code = ""


def main():
mac = ':'.join(re.findall('..', '%012x' % uuid.getnode()))
data = {"pairing_code": str(code), "brand_code": "eritv"}
print(data)
req = requests.post("https://backoffice.4net.tv/api/device/pairDeviceByPairingCode/", json = data, headers = {"Content-Type": "application/json"}).json()
if req["success"] == True:
token = req["token"]
data = {"device_token": token, "device_type_code": "ANDROIDTV", "model": "XiaomiTVBox", "name": "STB", "serial_number": "unknown", "mac_address": mac}
req = requests.post("https://backoffice.4net.tv/api/device/completeDevicePairing/", json = data, headers = {"Content-Type": "application/json"}).json()
if req["success"] == True:
data = {"token": token}
json_object = json.dumps(data, indent=4)
with open("eritv_token.json", "w") as outfile:
outfile.write(json_object)
print("Spárováno")
else:
print(req["message"])
else:
print(req["message"])
input("\nPro ukončení stiskněte klávesu Enter")
sys.exit(0)


if __name__ == "__main__":
main()
46 changes: 46 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from providers.antik import antik
from providers.lepsitv import lepsitv
from providers.ivysilani import ivysilani
from providers.eritv import eritv
import czech_sort


Expand Down Expand Up @@ -407,6 +408,51 @@ def telly_list():
return ""
return template(style_links, info)

@route("/eritv/playlist")
def eritv_playlist():
t = ""
for x, y in eritv.channels.items():
t = t + '#EXTINF:-1 provider="eritv" tvg-logo="https://epg.tv.itself.cz/files/channel_logos/' + str(x) + '.png"' + catchup + y[0].replace(" HD", "") + "\n" + input_stream + "http://" + str(
HOST) + ":" + str(PORT) + "/eritv/" + str(x) + ".m3u8\n"
if t != "":
t = "#EXTM3U\n" + t
response.content_type = 'text/plain; charset=UTF-8'
return t


@route("/eritv/<id>")
def eritv_play(id):
if 'utc' in request.query:
if 'utcend' in request.query:
end = request.query["utcend"]
else:
now = int(datetime.now().timestamp())
end = int(request.query["utc"]) + 10800
if end > now:
end = now - 60
try:
stream = eritv.get_catchup(str(id.split(".")[0]),
request.query["utc"], str(end))
except:
stream = eritv.channels[int(id.split(".")[0])][1]
else:
stream = eritv.channels[int(id.split(".")[0])][1]
response.content_type = "application/x-mpegURL"
return redirect(stream)


@route("/eritv/list")
def eritv_list():
names = []
info = {'title': 'Eritv'}
try:
for x, y in eritv.channels.items():
names.append(('/eritv/' + str(x) + '.m3u8', y[0].replace(" HD", "")))

info["names"] = names
except:
return ""
return template(style_links, info)

@route("/rebit/playlist")
def rebit_playlist():
Expand Down