]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/vodplatform.py
[extractor/common] Relax interaction count extraction in _json_ld
[youtube-dl] / 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\.kwikmotion\.com)/[eE]mbed/(?P<id>[^/?#]+)'
10     _TESTS = [{
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         'url': 'http://embed.kwikmotion.com/embed/RufMcytHDolTH1MuKHY9Fw',
21         'only_matching': True,
22     }]
23
24     def _real_extract(self, url):
25         video_id = self._match_id(url)
26         webpage = self._download_webpage(url, video_id)
27
28         title = unescapeHTML(self._og_search_title(webpage))
29         hidden_inputs = self._hidden_inputs(webpage)
30
31         formats = self._extract_wowza_formats(
32             hidden_inputs.get('HiddenmyhHlsLink') or hidden_inputs['HiddenmyDashLink'], video_id, skip_protocols=['f4m', 'smil'])
33         self._sort_formats(formats)
34
35         return {
36             'id': video_id,
37             'title': title,
38             'thumbnail': hidden_inputs.get('HiddenThumbnail') or self._og_search_thumbnail(webpage),
39             'formats': formats,
40         }