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

tv4play: fixed a crash if someone tried to download a geoblock file

fixed: #972
This commit is contained in:
Johan Andersson 2018-09-23 21:32:02 +02:00
parent ad75ef77f0
commit e292e39a59

View File

@ -73,6 +73,9 @@ class Tv4play(Service, OpenGraphThumbMixin):
url = "https://playback-api.b17g.net/media/{}?service=tv4&device=browser&protocol=hls%2Cdash&drm=widevine".format(vid)
res = self.http.request("get", url, cookies=self.cookies)
if res.status_code > 200:
yield ServiceError("Can't play this because the video is geoblocked.")
return
if res.json()["playbackItem"]["type"] == "hls":
streams = hlsparse(self.config, self.http.request("get", res.json()["playbackItem"]["manifestUrl"]),
res.json()["playbackItem"]["manifestUrl"], output=self.output, httpobject=self.http)
@ -136,6 +139,9 @@ class Tv4(Service, OpenGraphThumbMixin):
url = "https://playback-api.b17g.net/media/{}?service=tv4&device=browser&protocol=hls%2Cdash&drm=widevine".format(self.output["id"])
res = self.http.request("get", url, cookies=self.cookies)
if res.status_code > 200:
yield ServiceError("Can't play this because the video is geoblocked.")
return
if res.json()["playbackItem"]["type"] == "hls":
streams = hlsparse(self.config, self.http.request("get", res.json()["playbackItem"]["manifestUrl"]),
res.json()["playbackItem"]["manifestUrl"], output=self.output)