1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

HLS: handle 403 error when the playlist is geoblocked

This commit is contained in:
Johan Andersson 2015-10-04 17:41:11 +02:00
parent 2eef43843d
commit c7373854f9

View File

@ -9,7 +9,7 @@ import copy
from svtplay_dl.output import progressbar, progress_stream, ETA, output
from svtplay_dl.log import log
from svtplay_dl.utils.urllib import urlparse
from svtplay_dl.error import UIException
from svtplay_dl.error import UIException, ServiceError
from svtplay_dl.fetcher import VideoRetriever
@ -43,9 +43,13 @@ def _get_full_url(url, srcurl):
def hlsparse(options, res, url):
files = (parsem3u(res.text))[1]
streams = {}
if res.status_code == 403:
streams[0] = ServiceError("Can't read HDS playlist. permission denied")
return streams
files = (parsem3u(res.text))[1]
for i in files:
bitrate = float(i[1]["BANDWIDTH"])/1000
streams[int(bitrate)] = HLS(copy.copy(options), _get_full_url(i[0], url), bitrate, cookies=res.cookies)