[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / bandaichannel.py
blobd7fcf44bd948e014523f90409f181c59e675945b
1 from .brightcove import BrightcoveNewBaseIE
2 from ..utils import extract_attributes
5 class BandaiChannelIE(BrightcoveNewBaseIE):
6 IE_NAME = 'bandaichannel'
7 _VALID_URL = r'https?://(?:www\.)?b-ch\.com/titles/(?P<id>\d+/\d+)'
8 _TESTS = [{
9 'url': 'https://www.b-ch.com/titles/514/001',
10 'md5': 'a0f2d787baa5729bed71108257f613a4',
11 'info_dict': {
12 'id': '6128044564001',
13 'ext': 'mp4',
14 'title': 'メタルファイターMIKU 第1話',
15 'timestamp': 1580354056,
16 'uploader_id': '5797077852001',
17 'upload_date': '20200130',
18 'duration': 1387.733,
20 'params': {
21 'skip_download': True,
25 def _real_extract(self, url):
26 video_id = self._match_id(url)
27 webpage = self._download_webpage(url, video_id)
28 attrs = extract_attributes(self._search_regex(
29 r'(<video-js[^>]+\bid="bcplayer"[^>]*>)', webpage, 'player'))
30 bc = self._download_json(
31 'https://pbifcd.b-ch.com/v1/playbackinfo/ST/70/' + attrs['data-info'],
32 video_id, headers={'X-API-KEY': attrs['data-auth'].strip()})['bc']
33 return self._parse_brightcove_metadata(bc, bc['id'])