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:
parent
2eef43843d
commit
c7373854f9
@ -9,7 +9,7 @@ import copy
|
|||||||
from svtplay_dl.output import progressbar, progress_stream, ETA, output
|
from svtplay_dl.output import progressbar, progress_stream, ETA, output
|
||||||
from svtplay_dl.log import log
|
from svtplay_dl.log import log
|
||||||
from svtplay_dl.utils.urllib import urlparse
|
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
|
from svtplay_dl.fetcher import VideoRetriever
|
||||||
|
|
||||||
|
|
||||||
@ -43,9 +43,13 @@ def _get_full_url(url, srcurl):
|
|||||||
|
|
||||||
|
|
||||||
def hlsparse(options, res, url):
|
def hlsparse(options, res, url):
|
||||||
files = (parsem3u(res.text))[1]
|
|
||||||
streams = {}
|
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:
|
for i in files:
|
||||||
bitrate = float(i[1]["BANDWIDTH"])/1000
|
bitrate = float(i[1]["BANDWIDTH"])/1000
|
||||||
streams[int(bitrate)] = HLS(copy.copy(options), _get_full_url(i[0], url), bitrate, cookies=res.cookies)
|
streams[int(bitrate)] = HLS(copy.copy(options), _get_full_url(i[0], url), bitrate, cookies=res.cookies)
|
||||||
|
Loading…
Reference in New Issue
Block a user