1 from ..utils
import HEADRequest
2 from .common
import InfoExtractor
5 class FujiTVFODPlus7IE(InfoExtractor
):
6 _VALID_URL
= r
'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
7 _BASE_URL
= 'https://i.fod.fujitv.co.jp/'
17 'url': 'https://fod.fujitv.co.jp/title/5d40/5d40110076',
21 'title': '#1318 『まる子、まぼろしの洋館を見る』の巻',
24 'description': 'md5:b3f51dbfdda162ac4f789e0ff4d65750',
25 'thumbnail': 'https://i.fod.fujitv.co.jp/img/program/5d40/episode/5d40110076_a.jpg',
28 'url': 'https://fod.fujitv.co.jp/title/5d40/5d40810083',
32 'title': '#1324 『まる子とオニの子』の巻/『結成!2月をムダにしない会』の巻',
33 'description': 'md5:3972d900b896adc8ab1849e310507efa',
36 'thumbnail': 'https://i.fod.fujitv.co.jp/img/program/5d40/episode/5d40810083_a.jpg'},
37 'skip': 'Video available only in one week'
40 def _real_extract(self
, url
):
41 series_id
, video_id
= self
._match
_valid
_url
(url
).groups()
42 self
._request
_webpage
(HEADRequest(url
), video_id
)
44 token
= self
._get
_cookies
(url
).get('CT')
46 json_info
= self
._download
_json
('https://fod-sp.fujitv.co.jp/apps/api/episode/detail/?ep_id=%s&is_premium=false' % video_id
, video_id
, headers
={'x-authorization': f'Bearer {token.value}
'}, fatal=False)
48 self.report_warning(f'The token cookie
is needed to extract video metadata
. {self._LOGIN_HINTS["cookies"]}
')
49 formats, subtitles = [], {}
50 src_json = self._download_json(f'{self._BASE_URL}abrjson_v2
/tv_android
/{video_id}
', video_id)
51 for src in src_json['video_selector
']:
52 if not src.get('url
'):
54 fmt, subs = self._extract_m3u8_formats_and_subtitles(src['url
'], video_id, 'ts
')
56 f.update(dict(zip(('height
', 'width
'),
57 self._BITRATE_MAP.get(f.get('tbr
'), ()))))
59 subtitles = self._merge_subtitles(subtitles, subs)
60 self._sort_formats(formats, ['tbr
'])
64 'title
': json_info.get('ep_title
'),
65 'series
': json_info.get('lu_title
'),
66 'series_id
': series_id,
67 'description
': json_info.get('ep_description
'),
69 'subtitles
': subtitles,
70 'thumbnail
': f'{self._BASE_URL}img
/program
/{series_id}
/episode
/{video_id}_a
.jpg
',