logo

youtube-dl

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

businessinsider.py (1998B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from .jwplatform import JWPlatformIE
  5. class BusinessInsiderIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:[^/]+\.)?businessinsider\.(?:com|nl)/(?:[^/]+/)*(?P<id>[^/?#&]+)'
  7. _TESTS = [{
  8. 'url': 'http://uk.businessinsider.com/how-much-radiation-youre-exposed-to-in-everyday-life-2016-6',
  9. 'md5': 'ffed3e1e12a6f950aa2f7d83851b497a',
  10. 'info_dict': {
  11. 'id': 'cjGDb0X9',
  12. 'ext': 'mp4',
  13. 'title': "Bananas give you more radiation exposure than living next to a nuclear power plant",
  14. 'description': 'md5:0175a3baf200dd8fa658f94cade841b3',
  15. 'upload_date': '20160611',
  16. 'timestamp': 1465675620,
  17. },
  18. }, {
  19. 'url': 'https://www.businessinsider.nl/5-scientifically-proven-things-make-you-less-attractive-2017-7/',
  20. 'md5': '43f438dbc6da0b89f5ac42f68529d84a',
  21. 'info_dict': {
  22. 'id': '5zJwd4FK',
  23. 'ext': 'mp4',
  24. 'title': 'Deze dingen zorgen ervoor dat je minder snel een date scoort',
  25. 'description': 'md5:2af8975825d38a4fed24717bbe51db49',
  26. 'upload_date': '20170705',
  27. 'timestamp': 1499270528,
  28. },
  29. }, {
  30. 'url': 'http://www.businessinsider.com/excel-index-match-vlookup-video-how-to-2015-2?IR=T',
  31. 'only_matching': True,
  32. }]
  33. def _real_extract(self, url):
  34. video_id = self._match_id(url)
  35. webpage = self._download_webpage(url, video_id)
  36. jwplatform_id = self._search_regex(
  37. (r'data-media-id=["\']([a-zA-Z0-9]{8})',
  38. r'id=["\']jwplayer_([a-zA-Z0-9]{8})',
  39. r'id["\']?\s*:\s*["\']?([a-zA-Z0-9]{8})',
  40. r'(?:jwplatform\.com/players/|jwplayer_)([a-zA-Z0-9]{8})'),
  41. webpage, 'jwplatform id')
  42. return self.url_result(
  43. 'jwplatform:%s' % jwplatform_id, ie=JWPlatformIE.ie_key(),
  44. video_id=video_id)