mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-28 06:04:17 +01:00
subtitle: support for cookies
This commit is contained in:
parent
fa6a4c61d2
commit
e94975b256
@ -60,6 +60,7 @@ class Options(object):
|
|||||||
self.verbose = False
|
self.verbose = False
|
||||||
self.output_auto = False
|
self.output_auto = False
|
||||||
self.service = None
|
self.service = None
|
||||||
|
self.cookies = None
|
||||||
|
|
||||||
def get_media(url, options):
|
def get_media(url, options):
|
||||||
|
|
||||||
|
@ -12,19 +12,16 @@ class subtitle(object):
|
|||||||
self.options = options
|
self.options = options
|
||||||
self.subtype = subtype
|
self.subtype = subtype
|
||||||
|
|
||||||
def get_subdata(self):
|
|
||||||
if self.subtitle is None:
|
|
||||||
try:
|
|
||||||
self.subtitle = get_http_data(self.url)
|
|
||||||
except HTTPError:
|
|
||||||
return None
|
|
||||||
return self.subtitle
|
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
subdata = self.get_subdata()
|
try:
|
||||||
if subdata is None:
|
subdata = get_http_data(self.url, cookiejar=self.options.cookies)
|
||||||
log.error("Can't download subtitle.")
|
except HTTPError as e:
|
||||||
return
|
if e.code == 403:
|
||||||
|
log.error("Permission denied")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
log.error("Can't download subtitle")
|
||||||
|
return
|
||||||
|
|
||||||
data = None
|
data = None
|
||||||
if self.subtype == "tt":
|
if self.subtype == "tt":
|
||||||
|
Loading…
Reference in New Issue
Block a user