logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

fujitv.py (1055B)


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