[fujitv] Extract resolution for free sources (#2685)

Authored by: YuenSzeHong
This commit is contained in:
YuenSzeHong 2022-02-13 22:39:01 +08:00 committed by GitHub
parent da42679b87
commit b1cb0525ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,13 @@
class FujiTVFODPlus7IE(InfoExtractor): class FujiTVFODPlus7IE(InfoExtractor):
_VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)' _VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/(?P<sid>[0-9a-z]{4})/(?P<id>[0-9a-z]+)'
_BASE_URL = 'https://i.fod.fujitv.co.jp/' _BASE_URL = 'https://i.fod.fujitv.co.jp/'
_BITRATE_MAP = {
300: (320, 180),
800: (640, 360),
1200: (1280, 720),
2000: (1280, 720),
4000: (1920, 1080),
}
_TESTS = [{ _TESTS = [{
'url': 'https://fod.fujitv.co.jp/title/5d40/5d40110076', 'url': 'https://fod.fujitv.co.jp/title/5d40/5d40110076',
@ -19,6 +26,17 @@ class FujiTVFODPlus7IE(InfoExtractor):
'description': 'md5:b3f51dbfdda162ac4f789e0ff4d65750', 'description': 'md5:b3f51dbfdda162ac4f789e0ff4d65750',
'thumbnail': 'https://i.fod.fujitv.co.jp/img/program/5d40/episode/5d40110076_a.jpg', 'thumbnail': 'https://i.fod.fujitv.co.jp/img/program/5d40/episode/5d40110076_a.jpg',
}, },
}, {
'url': 'https://fod.fujitv.co.jp/title/5d40/5d40810083',
'info_dict': {
'id': '5d40810083',
'ext': 'mp4',
'title': '#1324 『まる子とオニの子』の巻『結成2月をムダにしない会』の巻',
'description': 'md5:3972d900b896adc8ab1849e310507efa',
'series': 'ちびまる子ちゃん',
'series_id': '5d40',
'thumbnail': 'https://i.fod.fujitv.co.jp/img/program/5d40/episode/5d40810083_a.jpg'},
'skip': 'Video available only in one week'
}] }]
def _real_extract(self, url): def _real_extract(self, url):
@ -36,6 +54,9 @@ def _real_extract(self, url):
if not src.get('url'): if not src.get('url'):
continue continue
fmt, subs = self._extract_m3u8_formats_and_subtitles(src['url'], video_id, 'mp4') fmt, subs = self._extract_m3u8_formats_and_subtitles(src['url'], video_id, 'mp4')
for f in fmt:
f.update(dict(zip(('height', 'width'),
self._BITRATE_MAP.get(f.get('tbr'), ()))))
formats.extend(fmt) formats.extend(fmt)
subtitles = self._merge_subtitles(subtitles, subs) subtitles = self._merge_subtitles(subtitles, subs)
self._sort_formats(formats, ['tbr']) self._sort_formats(formats, ['tbr'])