mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 16:42:57 +01:00
86e5f3ed2e
Using https://github.com/asottile/pyupgrade 1. `__future__` imports and `coding: utf-8` were removed 2. Files were rewritten with `pyupgrade --py36-plus --keep-percent-format` 3. f-strings were cherry-picked from `pyupgrade --py36-plus` Extractors are left untouched (except removing header) to avoid unnecessary merge conflicts
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
from .brightcove import BrightcoveNewIE
|
|
from ..utils import extract_attributes
|
|
|
|
|
|
class BandaiChannelIE(BrightcoveNewIE):
|
|
IE_NAME = 'bandaichannel'
|
|
_VALID_URL = r'https?://(?:www\.)?b-ch\.com/titles/(?P<id>\d+/\d+)'
|
|
_TESTS = [{
|
|
'url': 'https://www.b-ch.com/titles/514/001',
|
|
'md5': 'a0f2d787baa5729bed71108257f613a4',
|
|
'info_dict': {
|
|
'id': '6128044564001',
|
|
'ext': 'mp4',
|
|
'title': 'メタルファイターMIKU 第1話',
|
|
'timestamp': 1580354056,
|
|
'uploader_id': '5797077852001',
|
|
'upload_date': '20200130',
|
|
'duration': 1387.733,
|
|
},
|
|
'params': {
|
|
'skip_download': True,
|
|
},
|
|
}]
|
|
|
|
def _real_extract(self, url):
|
|
video_id = self._match_id(url)
|
|
webpage = self._download_webpage(url, video_id)
|
|
attrs = extract_attributes(self._search_regex(
|
|
r'(<video-js[^>]+\bid="bcplayer"[^>]*>)', webpage, 'player'))
|
|
bc = self._download_json(
|
|
'https://pbifcd.b-ch.com/v1/playbackinfo/ST/70/' + attrs['data-info'],
|
|
video_id, headers={'X-API-KEY': attrs['data-auth'].strip()})['bc']
|
|
return self._parse_brightcove_metadata(bc, bc['id'])
|