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.

36 lines
1.4 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class TheStarIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?thestar\.com/(?:[^/]+/)*(?P<id>.+)\.html'
  6. _TEST = {
  7. 'url': 'http://www.thestar.com/life/2016/02/01/mankind-why-this-woman-started-a-men-s-skincare-line.html',
  8. 'md5': '2c62dd4db2027e35579fefb97a8b6554',
  9. 'info_dict': {
  10. 'id': '4732393888001',
  11. 'ext': 'mp4',
  12. 'title': 'Mankind: Why this woman started a men\'s skin care line',
  13. 'description': 'Robert Cribb talks to Young Lee, the founder of Uncle Peter\'s MAN.',
  14. 'uploader_id': '794267642001',
  15. 'timestamp': 1454353482,
  16. 'upload_date': '20160201',
  17. },
  18. 'params': {
  19. # m3u8 download
  20. 'skip_download': True,
  21. }
  22. }
  23. BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/794267642001/default_default/index.html?videoId=%s'
  24. def _real_extract(self, url):
  25. display_id = self._match_id(url)
  26. webpage = self._download_webpage(url, display_id)
  27. brightcove_id = self._search_regex(
  28. r'mainartBrightcoveVideoId["\']?\s*:\s*["\']?(\d+)',
  29. webpage, 'brightcove id')
  30. return self.url_result(
  31. self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id,
  32. 'BrightcoveNew', brightcove_id)