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