]>
Commit | Line | Data |
---|---|---|
ec5e77c5 | 1 | from .brightcove import BrightcoveNewIE |
2 | from ..utils import extract_attributes | |
3 | ||
4 | ||
6368e2e6 | 5 | class BandaiChannelIE(BrightcoveNewIE): # XXX: Do not subclass from concrete IE |
ec5e77c5 | 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, | |
19 | }, | |
20 | 'params': { | |
ec5e77c5 | 21 | 'skip_download': True, |
22 | }, | |
23 | }] | |
24 | ||
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']) |