mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 06:27:21 +00:00
[BiliBiliBangumiIE] supports play_info extraction from webpage
- i.e. extracts premiums formats with logged-in cookies, haven't tested with format `12240` yet. * test url: https://www.bilibili.com/bangumi/play/ep829434, cookies: logged-in, non-premium
This commit is contained in:
parent
79bb63957d
commit
13ed574168
|
@ -864,10 +864,16 @@ def _real_extract(self, url):
|
||||||
self.raise_login_required('This video is for premium members only')
|
self.raise_login_required('This video is for premium members only')
|
||||||
|
|
||||||
headers['Referer'] = url
|
headers['Referer'] = url
|
||||||
|
|
||||||
|
play_info = self._search_json(
|
||||||
|
r'playurlSSRData\s*?=\s*?', webpage, 'embedded page info', episode_id,
|
||||||
|
end_pattern='\n', default=None)
|
||||||
|
if not play_info:
|
||||||
play_info = self._download_json(
|
play_info = self._download_json(
|
||||||
'https://api.bilibili.com/pgc/player/web/v2/playurl', episode_id,
|
'https://api.bilibili.com/pgc/player/web/v2/playurl', episode_id,
|
||||||
'Extracting episode', query={'fnval': 12240, 'ep_id': episode_id},
|
'Extracting episode', query={'fnval': 12240, 'ep_id': episode_id},
|
||||||
headers=headers)
|
headers=headers)
|
||||||
|
|
||||||
premium_only = play_info.get('code') == -10403
|
premium_only = play_info.get('code') == -10403
|
||||||
play_info = traverse_obj(play_info, ('result', 'video_info', {dict})) or {}
|
play_info = traverse_obj(play_info, ('result', 'video_info', {dict})) or {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue