Compare commits

...

4 Commits

1 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import json
import urllib
import urllib.parse
from .common import InfoExtractor
from .youtube import YoutubeIE
@ -9,6 +9,7 @@
qualities,
str_or_none,
url_or_none,
bug_reports_message,
)
from ..utils.traversal import traverse_obj
@ -173,7 +174,7 @@ def _real_extract(self, url):
auth_data = json.loads(urllib.parse.unquote(auth_cookie.value))
auth_headers['Authorization'] = f'Bearer {auth_data["accessToken"]}'
except (json.JSONDecodeError, KeyError):
self.report_warning('Failed to extract token from auth cookie.')
self.report_warning(f'Failed to extract token from auth cookie{bug_reports_message()}')
post = self._download_json(
f'https://api.boosty.to/v1/blog/{user}/post/{post_id}', post_id,
@ -215,9 +216,9 @@ def _real_extract(self, url):
'thumbnail': (('previewUrl', 'defaultPreview'), {url_or_none}),
}, get_all=False)})
if not post.get('hasAccess'):
self.raise_login_required('This post requires a subscription', True, method='cookies')
if not entries:
if not entries and not post.get('hasAccess'):
self.raise_login_required('This post requires a subscription', metadata_available=True)
elif not entries:
raise ExtractorError('No videos found', expected=True)
if len(entries) == 1:
return entries[0]