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.3 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import unescapeHTML
  5. class VODPlatformIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?vod-platform\.net/embed/(?P<id>[^/?#]+)'
  7. _TEST = {
  8. # from http://www.lbcgroup.tv/watch/chapter/29143/52844/%D8%A7%D9%84%D9%86%D8%B5%D8%B1%D8%A9-%D9%81%D9%8A-%D8%B6%D9%8A%D8%A7%D9%81%D8%A9-%D8%A7%D9%84%D9%80-cnn/ar
  9. 'url': 'http://vod-platform.net/embed/RufMcytHDolTH1MuKHY9Fw',
  10. 'md5': '1db2b7249ce383d6be96499006e951fc',
  11. 'info_dict': {
  12. 'id': 'RufMcytHDolTH1MuKHY9Fw',
  13. 'ext': 'mp4',
  14. 'title': 'LBCi News_ النصرة في ضيافة الـ "سي.أن.أن"',
  15. }
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. webpage = self._download_webpage(url, video_id)
  20. title = unescapeHTML(self._og_search_title(webpage))
  21. hidden_inputs = self._hidden_inputs(webpage)
  22. base_url = self._search_regex(
  23. '(.*/)(?:playlist.m3u8|manifest.mpd)',
  24. hidden_inputs.get('HiddenmyhHlsLink') or hidden_inputs['HiddenmyDashLink'],
  25. 'base url')
  26. formats = self._extract_m3u8_formats(
  27. base_url + 'playlist.m3u8', video_id, 'mp4',
  28. 'm3u8_native', m3u8_id='hls', fatal=False)
  29. formats.extend(self._extract_mpd_formats(
  30. base_url + 'manifest.mpd', video_id,
  31. mpd_id='dash', fatal=False))
  32. rtmp_formats = self._extract_smil_formats(
  33. base_url + 'jwplayer.smil', video_id, fatal=False)
  34. for rtmp_format in rtmp_formats:
  35. rtsp_format = rtmp_format.copy()
  36. rtsp_format['url'] = '%s/%s' % (rtmp_format['url'], rtmp_format['play_path'])
  37. del rtsp_format['play_path']
  38. del rtsp_format['ext']
  39. rtsp_format.update({
  40. 'url': rtsp_format['url'].replace('rtmp://', 'rtsp://'),
  41. 'format_id': rtmp_format['format_id'].replace('rtmp', 'rtsp'),
  42. 'protocol': 'rtsp',
  43. })
  44. formats.extend([rtmp_format, rtsp_format])
  45. self._sort_formats(formats)
  46. return {
  47. 'id': video_id,
  48. 'title': title,
  49. 'thumbnail': hidden_inputs.get('HiddenThumbnail') or self._og_search_thumbnail(webpage),
  50. 'formats': formats,
  51. }