]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/bandaichannel.py
[youtube] Add extractor-arg to skip auto-translated subs
[yt-dlp.git] / yt_dlp / extractor / bandaichannel.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .brightcove import BrightcoveNewIE
5 from ..utils import extract_attributes
6
7
8 class BandaiChannelIE(BrightcoveNewIE):
9 IE_NAME = 'bandaichannel'
10 _VALID_URL = r'https?://(?:www\.)?b-ch\.com/titles/(?P<id>\d+/\d+)'
11 _TESTS = [{
12 'url': 'https://www.b-ch.com/titles/514/001',
13 'md5': 'a0f2d787baa5729bed71108257f613a4',
14 'info_dict': {
15 'id': '6128044564001',
16 'ext': 'mp4',
17 'title': 'メタルファイターMIKU 第1話',
18 'timestamp': 1580354056,
19 'uploader_id': '5797077852001',
20 'upload_date': '20200130',
21 'duration': 1387.733,
22 },
23 'params': {
24 'skip_download': True,
25 },
26 }]
27
28 def _real_extract(self, url):
29 video_id = self._match_id(url)
30 webpage = self._download_webpage(url, video_id)
31 attrs = extract_attributes(self._search_regex(
32 r'(<video-js[^>]+\bid="bcplayer"[^>]*>)', webpage, 'player'))
33 bc = self._download_json(
34 'https://pbifcd.b-ch.com/v1/playbackinfo/ST/70/' + attrs['data-info'],
35 video_id, headers={'X-API-KEY': attrs['data-auth'].strip()})['bc']
36 return self._parse_brightcove_metadata(bc, bc['id'])