]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/inc.py
[ie/orf:on] Improve extraction (#9677)
[yt-dlp.git] / yt_dlp / extractor / inc.py
CommitLineData
7f0bdc7a 1from .common import InfoExtractor
366b759a 2from .kaltura import KalturaIE
7f0bdc7a
DR
3
4
5class IncIE(InfoExtractor):
366b759a 6 _VALID_URL = r'https?://(?:www\.)?inc\.com/(?:[^/]+/)+(?P<id>[^.]+).html'
7f0bdc7a
DR
7 _TESTS = [{
8 'url': 'http://www.inc.com/tip-sheet/bill-gates-says-these-5-books-will-make-you-smarter.html',
9 'md5': '7416739c9c16438c09fa35619d6ba5cb',
10 'info_dict': {
11 'id': '1_wqig47aq',
12 'ext': 'mov',
13 'title': 'Bill Gates Says These 5 Books Will Make You Smarter',
14 'description': 'md5:bea7ff6cce100886fc1995acb743237e',
15 'timestamp': 1474414430,
16 'upload_date': '20160920',
17 'uploader_id': 'video@inc.com',
18 },
366b759a
S
19 'params': {
20 'skip_download': True,
21 },
ff2e4862
S
22 }, {
23 # div with id=kaltura_player_1_kqs38cgm
24 'url': 'https://www.inc.com/oscar-raymundo/richard-branson-young-entrepeneurs.html',
25 'info_dict': {
26 'id': '1_kqs38cgm',
27 'ext': 'mp4',
28 'title': 'Branson: "In the end, you have to say, Screw it. Just do it."',
29 'description': 'md5:21b832d034f9af5191ca5959da5e9cb6',
30 'timestamp': 1364403232,
31 'upload_date': '20130327',
32 'uploader_id': 'incdigital@inc.com',
33 },
34 'params': {
35 'skip_download': True,
36 },
7f0bdc7a
DR
37 }, {
38 'url': 'http://www.inc.com/video/david-whitford/founders-forum-tripadvisor-steve-kaufer-most-enjoyable-moment-for-entrepreneur.html',
39 'only_matching': True,
40 }]
41
42 def _real_extract(self, url):
43 display_id = self._match_id(url)
44 webpage = self._download_webpage(url, display_id)
45
46 partner_id = self._search_regex(
ff2e4862
S
47 r'var\s+_?bizo_data_partner_id\s*=\s*["\'](\d+)', webpage,
48 'partner id', default='1034971')
7f0bdc7a 49
ff2e4862
S
50 kaltura_id = self._search_regex(
51 r'id=(["\'])kaltura_player_(?P<id>.+?)\1', webpage, 'kaltura id',
52 default=None, group='id') or self._parse_json(self._search_regex(
0645be49 53 r'pageInfo\.videos\s*=\s*\[(.+)\];', webpage, 'kaltura id'),
7f0bdc7a
DR
54 display_id)['vid_kaltura_id']
55
366b759a
S
56 return self.url_result(
57 'kaltura:%s:%s' % (partner_id, kaltura_id), KalturaIE.ie_key())