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