aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDéstin Reed <TRox1972@noreply.github.com>2017-01-08 19:28:16 +0100
committerSergey M․ <dstftw@gmail.com>2017-01-09 22:57:14 +0700
commit7f0bdc7a31f6a1f9f71189603906d64af0a6ab74 (patch)
treee8d1a8620b13d1b4b208e12d34d7675ce90afd4e
parent022a5d663bc654a2d5f650f209dd7a8f86ac38a8 (diff)
downloadyoutube-dl-7f0bdc7a31f6a1f9f71189603906d64af0a6ab74.tar.xz
[inc] Add extractor
-rw-r--r--youtube_dl/extractor/extractors.py1
-rw-r--r--youtube_dl/extractor/inc.py40
2 files changed, 41 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index 2e80ef152..5ba8efb0e 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -395,6 +395,7 @@ from .imgur import (
ImgurAlbumIE,
)
from .ina import InaIE
+from .inc import IncIE
from .indavideo import (
IndavideoIE,
IndavideoEmbedIE,
diff --git a/youtube_dl/extractor/inc.py b/youtube_dl/extractor/inc.py
new file mode 100644
index 000000000..279e53c15
--- /dev/null
+++ b/youtube_dl/extractor/inc.py
@@ -0,0 +1,40 @@
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class IncIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?inc\.com(?:/[\w-]+)+/(?P<id>[\w-]+)(?:\.html)?'
+ _TESTS = [{
+ 'url': 'http://www.inc.com/tip-sheet/bill-gates-says-these-5-books-will-make-you-smarter.html',
+ 'md5': '7416739c9c16438c09fa35619d6ba5cb',
+ 'info_dict': {
+ 'id': '1_wqig47aq',
+ 'ext': 'mov',
+ 'title': 'Bill Gates Says These 5 Books Will Make You Smarter',
+ 'description': 'md5:bea7ff6cce100886fc1995acb743237e',
+ 'timestamp': 1474414430,
+ 'upload_date': '20160920',
+ 'uploader_id': 'video@inc.com',
+ },
+ }, {
+ 'url': 'http://www.inc.com/video/david-whitford/founders-forum-tripadvisor-steve-kaufer-most-enjoyable-moment-for-entrepreneur.html',
+ 'only_matching': True,
+ }]
+
+ def _real_extract(self, url):
+ display_id = self._match_id(url)
+ webpage = self._download_webpage(url, display_id)
+
+ partner_id = self._search_regex(
+ r'var\s+_bizo_data_partner_id\s*=\s*"(\d+)";',
+ webpage,
+ 'partner id')
+
+ kaltura_id = self._parse_json(self._search_regex(
+ r'pageInfo\.videos\s*=\s*\[(.+)\];',
+ webpage,
+ 'kaltura id'),
+ display_id)['vid_kaltura_id']
+
+ return self.url_result('kaltura:%s:%s' % (partner_id, kaltura_id), 'Kaltura')