|
@@ -378,16 +378,38 @@ Referer: https://replay.lsm.lv/%s/%s
|
378
|
378
|
if not data2:
|
379
|
379
|
raise Exception("No stream found %s"%data)
|
380
|
380
|
|
381
|
|
- stream = util.item()
|
382
|
|
- stream["name"] = title
|
383
|
|
- stream["url"] = data2
|
384
|
|
- stream["img"] = img
|
385
|
|
- stream["desc"] = desc
|
386
|
|
- stream["resolver"] = "replay"
|
387
|
|
- stream["headers"] = headers
|
388
|
|
- stream["nfo"] = nfo
|
389
|
|
- #stream["filename"] = filename # TODO jāģenere jēdzigs faila nosaukums, kuru pēc tam izmanto downloadsb
|
390
|
|
- return [stream]
|
|
381
|
+ r2 = self._http_request(data2, headers=headers)
|
|
382
|
+ if not r2:
|
|
383
|
+ raise Exception("Stream is not accesible %s"%data)
|
|
384
|
+ streams = []
|
|
385
|
+ slist = re.findall("#EXT-X-STREAM-INF:([^\n]+)\n([^\n]+)", r2, re.DOTALL)
|
|
386
|
+ if not slist:
|
|
387
|
+ slist = [('BANDWIDTH=0,NAME="SD",RESOLUTION=?', data2)]
|
|
388
|
+ for cc in slist:
|
|
389
|
+ m = re.search("RESOLUTION=([\dx]+)",cc[0])
|
|
390
|
+ resolution = m.group(1) if m else "?"
|
|
391
|
+ m = re.search("BANDWIDTH=([\d]+)",cc[0])
|
|
392
|
+ bitrate = int(m.group(1)) if m else 0
|
|
393
|
+ url2 = cc[1].encode("utf8")
|
|
394
|
+ if not url2.startswith("http"):
|
|
395
|
+ uu = data2.split("/")[:-1]
|
|
396
|
+ uu.append(url2)
|
|
397
|
+ url2 = "/".join(uu)
|
|
398
|
+
|
|
399
|
+ stream = util.item()
|
|
400
|
+ stream["name"] = title
|
|
401
|
+ stream["url"] = url2
|
|
402
|
+ stream["img"] = img
|
|
403
|
+ stream["desc"] = desc
|
|
404
|
+ stream["resolver"] = "replay"
|
|
405
|
+ stream["headers"] = headers
|
|
406
|
+ stream["nfo"] = nfo
|
|
407
|
+ stream["quality"] = resolution
|
|
408
|
+ stream["order"] = bitrate
|
|
409
|
+ #stream["filename"] = filename # TODO jāģenere jēdzigs faila nosaukums, kuru pēc tam izmanto downloads
|
|
410
|
+ streams.append(stream)
|
|
411
|
+ streams = sorted(streams,key=lambda item: item["order"],reverse=True)
|
|
412
|
+ return streams
|
391
|
413
|
|
392
|
414
|
def is_video(self,data):
|
393
|
415
|
if "::" in data:
|