]>
Commit | Line | Data |
---|---|---|
29f7c58a | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
5 | ||
6 | ||
7 | class FujiTVFODPlus7IE(InfoExtractor): | |
61882afd | 8 | _VALID_URL = r'https?://fod\.fujitv\.co\.jp/title/[0-9a-z]{4}/(?P<id>[0-9a-z]+)' |
29f7c58a | 9 | _BASE_URL = 'http://i.fod.fujitv.co.jp/' |
10 | _BITRATE_MAP = { | |
11 | 300: (320, 180), | |
12 | 800: (640, 360), | |
13 | 1200: (1280, 720), | |
14 | 2000: (1280, 720), | |
61882afd | 15 | 4000: (1920, 1080), |
29f7c58a | 16 | } |
17 | ||
61882afd Y |
18 | _TESTS = [{ |
19 | 'url': 'https://fod.fujitv.co.jp/title/5d40/5d40810075', | |
20 | 'info_dict': { | |
21 | 'id': '5d40810075', | |
22 | 'title': '5d40810075', | |
23 | 'ext': 'mp4', | |
24 | 'format_id': '4000', | |
25 | 'thumbnail': 'http://i.fod.fujitv.co.jp/pc/image/wbtn/wbtn_5d40810075.jpg' | |
26 | }, | |
27 | 'skip': 'Expires after a week' | |
28 | }] | |
29 | ||
29f7c58a | 30 | def _real_extract(self, url): |
31 | video_id = self._match_id(url) | |
32 | formats = self._extract_m3u8_formats( | |
61882afd | 33 | self._BASE_URL + 'abr/tv_android/%s.m3u8' % video_id, video_id, 'mp4') |
29f7c58a | 34 | for f in formats: |
35 | wh = self._BITRATE_MAP.get(f.get('tbr')) | |
36 | if wh: | |
37 | f.update({ | |
38 | 'width': wh[0], | |
39 | 'height': wh[1], | |
40 | }) | |
41 | self._sort_formats(formats) | |
42 | ||
43 | return { | |
44 | 'id': video_id, | |
45 | 'title': video_id, | |
46 | 'formats': formats, | |
47 | 'thumbnail': self._BASE_URL + 'pc/image/wbtn/wbtn_%s.jpg' % video_id, | |
48 | } |