]>
Commit | Line | Data |
---|---|---|
7f0bdc7a DR |
1 | from __future__ import unicode_literals |
2 | ||
3 | from .common import InfoExtractor | |
366b759a | 4 | from .kaltura import KalturaIE |
7f0bdc7a DR |
5 | |
6 | ||
7 | class IncIE(InfoExtractor): | |
366b759a | 8 | _VALID_URL = r'https?://(?:www\.)?inc\.com/(?:[^/]+/)+(?P<id>[^.]+).html' |
7f0bdc7a DR |
9 | _TESTS = [{ |
10 | 'url': 'http://www.inc.com/tip-sheet/bill-gates-says-these-5-books-will-make-you-smarter.html', | |
11 | 'md5': '7416739c9c16438c09fa35619d6ba5cb', | |
12 | 'info_dict': { | |
13 | 'id': '1_wqig47aq', | |
14 | 'ext': 'mov', | |
15 | 'title': 'Bill Gates Says These 5 Books Will Make You Smarter', | |
16 | 'description': 'md5:bea7ff6cce100886fc1995acb743237e', | |
17 | 'timestamp': 1474414430, | |
18 | 'upload_date': '20160920', | |
19 | 'uploader_id': 'video@inc.com', | |
20 | }, | |
366b759a S |
21 | 'params': { |
22 | 'skip_download': True, | |
23 | }, | |
7f0bdc7a DR |
24 | }, { |
25 | 'url': 'http://www.inc.com/video/david-whitford/founders-forum-tripadvisor-steve-kaufer-most-enjoyable-moment-for-entrepreneur.html', | |
26 | 'only_matching': True, | |
27 | }] | |
28 | ||
29 | def _real_extract(self, url): | |
30 | display_id = self._match_id(url) | |
31 | webpage = self._download_webpage(url, display_id) | |
32 | ||
33 | partner_id = self._search_regex( | |
366b759a | 34 | r'var\s+_?bizo_data_partner_id\s*=\s*["\'](\d+)', webpage, 'partner id') |
7f0bdc7a DR |
35 | |
36 | kaltura_id = self._parse_json(self._search_regex( | |
366b759a | 37 | r'pageInfo\.videos\s*=\s*\[(.+)\];', webpage, 'kaltura id'), |
7f0bdc7a DR |
38 | display_id)['vid_kaltura_id'] |
39 | ||
366b759a S |
40 | return self.url_result( |
41 | 'kaltura:%s:%s' % (partner_id, kaltura_id), KalturaIE.ie_key()) |