mirror of https://github.com/yt-dlp/yt-dlp.git
[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 @@ class BiliBiliBangumiIE(BilibiliBaseIE):
|
||||||
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 New Issue