mirror of https://github.com/yt-dlp/yt-dlp.git
Compare commits
6 Commits
aa5286ad75
...
83ad8d46c7
Author | SHA1 | Date |
---|---|---|
Rasmus Antons | 83ad8d46c7 | |
rasmus | 4304bac272 | |
rasmus | 2fae8c3363 | |
rasmus | 3d66274d7f | |
Rasmus Antons | 3cf701bc59 | |
rasmus | 22acb01956 |
|
@ -1,3 +1,6 @@
|
|||
import json
|
||||
import urllib
|
||||
|
||||
from .common import InfoExtractor
|
||||
from .youtube import YoutubeIE
|
||||
from ..utils import (
|
||||
|
@ -162,9 +165,19 @@ def _extract_formats(self, player_urls, video_id):
|
|||
|
||||
def _real_extract(self, url):
|
||||
user, post_id = self._match_valid_url(url).group('user', 'post_id')
|
||||
|
||||
auth_cookie = self._get_cookies('https://boosty.to/').get('auth')
|
||||
auth_headers = {}
|
||||
if auth_cookie is not None:
|
||||
try:
|
||||
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.')
|
||||
|
||||
post = self._download_json(
|
||||
f'https://api.boosty.to/v1/blog/{user}/post/{post_id}', post_id,
|
||||
note='Downloading post data', errnote='Unable to download post data')
|
||||
note='Downloading post data', errnote='Unable to download post data', headers=auth_headers)
|
||||
|
||||
post_title = post.get('title')
|
||||
if not post_title:
|
||||
|
@ -202,6 +215,8 @@ 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:
|
||||
raise ExtractorError('No videos found', expected=True)
|
||||
if len(entries) == 1:
|
||||
|
|
Loading…
Reference in New Issue