]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/thestar.py
ba1380abcbeb3cb2a321b41695517f16f8cd6196
[youtubedl] / youtube_dl / extractor / thestar.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from .brightcove import BrightcoveLegacyIE
6 from ..compat import compat_parse_qs
7
8
9 class TheStarIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?thestar\.com/(?:[^/]+/)*(?P<id>.+)\.html'
11 _TEST = {
12 'url': 'http://www.thestar.com/life/2016/02/01/mankind-why-this-woman-started-a-men-s-skincare-line.html',
13 'md5': '2c62dd4db2027e35579fefb97a8b6554',
14 'info_dict': {
15 'id': '4732393888001',
16 'ext': 'mp4',
17 'title': 'Mankind: Why this woman started a men\'s skin care line',
18 'description': 'Robert Cribb talks to Young Lee, the founder of Uncle Peter\'s MAN.',
19 'uploader_id': '794267642001',
20 'timestamp': 1454353482,
21 'upload_date': '20160201',
22 },
23 'params': {
24 # m3u8 download
25 'skip_download': True,
26 }
27 }
28 BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/794267642001/default_default/index.html?videoId=%s'
29
30 def _real_extract(self, url):
31 display_id = self._match_id(url)
32 webpage = self._download_webpage(url, display_id)
33 brightcove_legacy_url = BrightcoveLegacyIE._extract_brightcove_url(webpage)
34 brightcove_id = compat_parse_qs(brightcove_legacy_url)['@videoPlayer'][0]
35 return self.url_result(self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew', brightcove_id)