You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..compat import compat_str
  4. from ..utils import (
  5. int_or_none,
  6. parse_duration,
  7. )
  8. class MwaveIE(InfoExtractor):
  9. _VALID_URL = r'https?://mwave\.interest\.me/mnettv/videodetail\.m\?searchVideoDetailVO\.clip_id=(?P<id>[0-9]+)'
  10. _TEST = {
  11. 'url': 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=168859',
  12. 'md5': 'c930e27b7720aaa3c9d0018dfc8ff6cc',
  13. 'info_dict': {
  14. 'id': '168859',
  15. 'ext': 'flv',
  16. 'title': '[M COUNTDOWN] SISTAR - SHAKE IT',
  17. 'thumbnail': 're:^https?://.*\.jpg$',
  18. 'uploader': 'M COUNTDOWN',
  19. 'duration': 206,
  20. 'view_count': int,
  21. }
  22. }
  23. def _real_extract(self, url):
  24. video_id = self._match_id(url)
  25. vod_info = self._download_json(
  26. 'http://mwave.interest.me/onair/vod_info.m?vodtype=CL&sectorid=&endinfo=Y&id=%s' % video_id,
  27. video_id, 'Download vod JSON')
  28. formats = []
  29. for num, cdn_info in enumerate(vod_info['cdn']):
  30. stream_url = cdn_info.get('url')
  31. if not stream_url:
  32. continue
  33. stream_name = cdn_info.get('name') or compat_str(num)
  34. f4m_stream = self._download_json(
  35. stream_url, video_id,
  36. 'Download %s stream JSON' % stream_name)
  37. f4m_url = f4m_stream.get('fileurl')
  38. if not f4m_url:
  39. continue
  40. formats.extend(
  41. self._extract_f4m_formats(f4m_url + '&hdcore=3.0.3', video_id, f4m_id=stream_name))
  42. self._sort_formats(formats)
  43. return {
  44. 'id': video_id,
  45. 'title': vod_info['title'],
  46. 'thumbnail': vod_info.get('cover'),
  47. 'uploader': vod_info.get('program_title'),
  48. 'duration': parse_duration(vod_info.get('time')),
  49. 'view_count': int_or_none(vod_info.get('hit')),
  50. 'formats': formats,
  51. }