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.

48 lines
1.7 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. int_or_none,
  6. js_to_json,
  7. smuggle_url,
  8. )
  9. class HGTVIE(InfoExtractor):
  10. _VALID_URL = r'https?://(?:www\.)?hgtv\.ca/[^/]+/video/(?P<id>[^/]+)/video.html'
  11. _TEST = {
  12. 'url': 'http://www.hgtv.ca/homefree/video/overnight-success/video.html?v=738081859718&p=1&s=da#video',
  13. 'md5': '',
  14. 'info_dict': {
  15. 'id': 'aFH__I_5FBOX',
  16. 'ext': 'mp4',
  17. 'title': 'Overnight Success',
  18. 'description': 'After weeks of hard work, high stakes, breakdowns and pep talks, the final 2 contestants compete to win the ultimate dream.',
  19. 'uploader': 'SHWM-NEW',
  20. 'timestamp': 1470320034,
  21. 'upload_date': '20160804',
  22. },
  23. 'params': {
  24. # m3u8 download
  25. 'skip_download': True,
  26. },
  27. }
  28. def _real_extract(self, url):
  29. display_id = self._match_id(url)
  30. webpage = self._download_webpage(url, display_id)
  31. embed_vars = self._parse_json(self._search_regex(
  32. r'(?s)embed_vars\s*=\s*({.*?});',
  33. webpage, 'embed vars'), display_id, js_to_json)
  34. return {
  35. '_type': 'url_transparent',
  36. 'url': smuggle_url(
  37. 'http://link.theplatform.com/s/dtjsEC/%s?mbr=true&manifest=m3u' % embed_vars['pid'], {
  38. 'force_smil_url': True
  39. }),
  40. 'series': embed_vars.get('show'),
  41. 'season_number': int_or_none(embed_vars.get('season')),
  42. 'episode_number': int_or_none(embed_vars.get('episode')),
  43. 'ie_key': 'ThePlatform',
  44. }