2 from __future__ import unicode_literals
6 from .brightcove import BrightcoveIE
7 from .common import InfoExtractor
8 from ..utils import ExtractorError
11 class NownessIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:(?:www|cn)\.)?nowness\.com/[^?#]*?/(?P<id>[0-9]+)/(?P<slug>[^/]+?)(?:$|[?#])'
16 'url': 'http://www.nowness.com/day/2013/6/27/3131/candor--the-art-of-gesticulation',
17 'md5': '068bc0202558c2e391924cb8cc470676',
19 'id': '2520295746001',
21 'title': 'Candor: The Art of Gesticulation',
22 'description': 'Candor: The Art of Gesticulation',
23 'thumbnail': 're:^https?://.*\.jpg',
24 'uploader': 'Nowness',
28 'url': 'http://cn.nowness.com/day/2014/8/7/4069/kasper-bj-rke-ft-jaakko-eino-kalevi--tnr',
29 'md5': 'e79cf125e387216f86b2e0a5b5c63aa3',
31 'id': '3716354522001',
33 'title': 'Kasper Bjørke ft. Jaakko Eino Kalevi: TNR',
34 'description': 'Kasper Bjørke ft. Jaakko Eino Kalevi: TNR',
35 'thumbnail': 're:^https?://.*\.jpg',
36 'uploader': 'Nowness',
41 def _real_extract(self, url):
42 mobj = re.match(self._VALID_URL, url)
43 video_id = mobj.group('slug')
45 webpage = self._download_webpage(url, video_id)
46 player_url = self._search_regex(
47 r'"([^"]+/content/issue-[0-9.]+.js)"', webpage, 'player URL')
48 real_id = self._search_regex(
49 r'\sdata-videoId="([0-9]+)"', webpage, 'internal video ID')
51 player_code = self._download_webpage(
53 note='Downloading player JavaScript',
54 errnote='Player download failed')
55 player_code = player_code.replace("'+d+'", real_id)
57 bc_url = BrightcoveIE._extract_brightcove_url(player_code)
59 raise ExtractorError('Could not find player definition')
63 'ie_key': 'Brightcove',