youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

fujitv.py (1055B)


      1 # coding: utf-8
      2 from __future__ import unicode_literals
      3 
      4 from .common import InfoExtractor
      5 
      6 
      7 class FujiTVFODPlus7IE(InfoExtractor):
      8     _VALID_URL = r'https?://i\.fod\.fujitv\.co\.jp/plus7/web/[0-9a-z]{4}/(?P<id>[0-9a-z]+)'
      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),
     15     }
     16 
     17     def _real_extract(self, url):
     18         video_id = self._match_id(url)
     19         formats = self._extract_m3u8_formats(
     20             self._BASE_URL + 'abr/pc_html5/%s.m3u8' % video_id, video_id, 'mp4')
     21         for f in formats:
     22             wh = self._BITRATE_MAP.get(f.get('tbr'))
     23             if wh:
     24                 f.update({
     25                     'width': wh[0],
     26                     'height': wh[1],
     27                 })
     28         self._sort_formats(formats)
     29 
     30         return {
     31             'id': video_id,
     32             'title': video_id,
     33             'formats': formats,
     34             'thumbnail': self._BASE_URL + 'pc/image/wbtn/wbtn_%s.jpg' % video_id,
     35         }