mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 12:15:40 +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.output_auto = False
|
||||
self.service = None
|
||||
self.cookies = None
|
||||
|
||||
def get_media(url, options):
|
||||
|
||||
|
@ -12,19 +12,16 @@ class subtitle(object):
|
||||
self.options = options
|
||||
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):
|
||||
subdata = self.get_subdata()
|
||||
if subdata is None:
|
||||
log.error("Can't download subtitle.")
|
||||
return
|
||||
try:
|
||||
subdata = get_http_data(self.url, cookiejar=self.options.cookies)
|
||||
except HTTPError as e:
|
||||
if e.code == 403:
|
||||
log.error("Permission denied")
|
||||
return
|
||||
else:
|
||||
log.error("Can't download subtitle")
|
||||
return
|
||||
|
||||
data = None
|
||||
if self.subtype == "tt":
|
||||
|
Loading…
Reference in New Issue
Block a user