diff --git a/lib/svtplay_dl/__init__.py b/lib/svtplay_dl/__init__.py index e084cb0..26a7aee 100644 --- a/lib/svtplay_dl/__init__.py +++ b/lib/svtplay_dl/__init__.py @@ -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): diff --git a/lib/svtplay_dl/subtitle/__init__.py b/lib/svtplay_dl/subtitle/__init__.py index fc22651..92e9d09 100644 --- a/lib/svtplay_dl/subtitle/__init__.py +++ b/lib/svtplay_dl/subtitle/__init__.py @@ -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":