You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5 KiB

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