1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

[inc] Improve (closes #11647)

This commit is contained in:
Sergey M․ 2017-01-09 23:08:59 +07:00
parent 7f0bdc7a31
commit 366b759a60
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -1,10 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from .kaltura import KalturaIE
class IncIE(InfoExtractor): class IncIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?inc\.com(?:/[\w-]+)+/(?P<id>[\w-]+)(?:\.html)?' _VALID_URL = r'https?://(?:www\.)?inc\.com/(?:[^/]+/)+(?P<id>[^.]+).html'
_TESTS = [{ _TESTS = [{
'url': 'http://www.inc.com/tip-sheet/bill-gates-says-these-5-books-will-make-you-smarter.html', 'url': 'http://www.inc.com/tip-sheet/bill-gates-says-these-5-books-will-make-you-smarter.html',
'md5': '7416739c9c16438c09fa35619d6ba5cb', 'md5': '7416739c9c16438c09fa35619d6ba5cb',
@ -17,6 +18,9 @@ class IncIE(InfoExtractor):
'upload_date': '20160920', 'upload_date': '20160920',
'uploader_id': 'video@inc.com', 'uploader_id': 'video@inc.com',
}, },
'params': {
'skip_download': True,
},
}, { }, {
'url': 'http://www.inc.com/video/david-whitford/founders-forum-tripadvisor-steve-kaufer-most-enjoyable-moment-for-entrepreneur.html', 'url': 'http://www.inc.com/video/david-whitford/founders-forum-tripadvisor-steve-kaufer-most-enjoyable-moment-for-entrepreneur.html',
'only_matching': True, 'only_matching': True,
@ -27,14 +31,11 @@ class IncIE(InfoExtractor):
webpage = self._download_webpage(url, display_id) webpage = self._download_webpage(url, display_id)
partner_id = self._search_regex( partner_id = self._search_regex(
r'var\s+_bizo_data_partner_id\s*=\s*"(\d+)";', r'var\s+_?bizo_data_partner_id\s*=\s*["\'](\d+)', webpage, 'partner id')
webpage,
'partner id')
kaltura_id = self._parse_json(self._search_regex( kaltura_id = self._parse_json(self._search_regex(
r'pageInfo\.videos\s*=\s*\[(.+)\];', r'pageInfo\.videos\s*=\s*\[(.+)\];', webpage, 'kaltura id'),
webpage,
'kaltura id'),
display_id)['vid_kaltura_id'] display_id)['vid_kaltura_id']
return self.url_result('kaltura:%s:%s' % (partner_id, kaltura_id), 'Kaltura') return self.url_result(
'kaltura:%s:%s' % (partner_id, kaltura_id), KalturaIE.ie_key())