1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

urplay: look for programcontainer to get the json we need

fixes: #1308
This commit is contained in:
Johan Andersson 2021-01-18 21:41:44 +01:00
parent c3ff0527fc
commit 4fce58c892

View File

@ -17,10 +17,14 @@ class Urplay(Service, OpenGraphThumbMixin):
supported_domains = ["urplay.se", "ur.se", "betaplay.ur.se", "urskola.se"] supported_domains = ["urplay.se", "ur.se", "betaplay.ur.se", "urskola.se"]
def get(self): def get(self):
key = "currentProduct"
match = re.search(r'/Player/Player" data-react-props="([^\"]+)\"', self.get_urldata()) match = re.search(r'/Player/Player" data-react-props="([^\"]+)\"', self.get_urldata())
if not match: if not match:
yield ServiceError("Can't find json info") key = "program"
return match = re.search(r'/ProgramContainer" data-react-props="([^\"]+)\"', self.get_urldata())
if not match:
yield ServiceError("Can't find json info")
return
data = unescape(match.group(1)) data = unescape(match.group(1))
jsondata = json.loads(data) jsondata = json.loads(data)
@ -28,8 +32,8 @@ class Urplay(Service, OpenGraphThumbMixin):
res = self.http.get("https://streaming-loadbalancer.ur.se/loadbalancer.json") res = self.http.get("https://streaming-loadbalancer.ur.se/loadbalancer.json")
loadbalancer = res.json()["redirect"] loadbalancer = res.json()["redirect"]
for streaminfo in jsondata["currentProduct"]["streamingInfo"].keys(): for streaminfo in jsondata[key]["streamingInfo"].keys():
stream = jsondata["currentProduct"]["streamingInfo"][streaminfo] stream = jsondata[key]["streamingInfo"][streaminfo]
if streaminfo == "raw": if streaminfo == "raw":
if "sd" in stream: if "sd" in stream:
url = "https://{}/{}playlist.m3u8".format(loadbalancer, stream["sd"]["location"]) url = "https://{}/{}playlist.m3u8".format(loadbalancer, stream["sd"]["location"])