thestar.py 1.3 KB

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