logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

inc.py (2299B)


  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. # div with id=kaltura_player_1_kqs38cgm
  23. 'url': 'https://www.inc.com/oscar-raymundo/richard-branson-young-entrepeneurs.html',
  24. 'info_dict': {
  25. 'id': '1_kqs38cgm',
  26. 'ext': 'mp4',
  27. 'title': 'Branson: "In the end, you have to say, Screw it. Just do it."',
  28. 'description': 'md5:21b832d034f9af5191ca5959da5e9cb6',
  29. 'timestamp': 1364403232,
  30. 'upload_date': '20130327',
  31. 'uploader_id': 'incdigital@inc.com',
  32. },
  33. 'params': {
  34. 'skip_download': True,
  35. },
  36. }, {
  37. 'url': 'http://www.inc.com/video/david-whitford/founders-forum-tripadvisor-steve-kaufer-most-enjoyable-moment-for-entrepreneur.html',
  38. 'only_matching': True,
  39. }]
  40. def _real_extract(self, url):
  41. display_id = self._match_id(url)
  42. webpage = self._download_webpage(url, display_id)
  43. partner_id = self._search_regex(
  44. r'var\s+_?bizo_data_partner_id\s*=\s*["\'](\d+)', webpage,
  45. 'partner id', default='1034971')
  46. kaltura_id = self._search_regex(
  47. r'id=(["\'])kaltura_player_(?P<id>.+?)\1', webpage, 'kaltura id',
  48. default=None, group='id') or self._parse_json(self._search_regex(
  49. r'pageInfo\.videos\s*=\s*\[(.+)\];', webpage, 'kaltura id'),
  50. display_id)['vid_kaltura_id']
  51. return self.url_result(
  52. 'kaltura:%s:%s' % (partner_id, kaltura_id), KalturaIE.ie_key())