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.

35 lines
1.2 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class HGTVComShowIE(InfoExtractor):
  5. IE_NAME = 'hgtv.com:show'
  6. _VALID_URL = r'https?://(?:www\.)?hgtv\.com/shows/[^/]+/(?P<id>[^/?#&]+)'
  7. _TEST = {
  8. 'url': 'http://www.hgtv.com/shows/flip-or-flop/flip-or-flop-full-episodes-videos',
  9. 'info_dict': {
  10. 'id': 'flip-or-flop-full-episodes-videos',
  11. 'title': 'Flip or Flop Full Episodes',
  12. },
  13. 'playlist_mincount': 15,
  14. }
  15. def _real_extract(self, url):
  16. display_id = self._match_id(url)
  17. webpage = self._download_webpage(url, display_id)
  18. config = self._parse_json(
  19. self._search_regex(
  20. r'(?s)data-module=["\']video["\'][^>]*>.*?<script[^>]+type=["\']text/x-config["\'][^>]*>(.+?)</script',
  21. webpage, 'video config'),
  22. display_id)['channels'][0]
  23. entries = [
  24. self.url_result(video['releaseUrl'])
  25. for video in config['videos'] if video.get('releaseUrl')]
  26. return self.playlist_result(
  27. entries, display_id, config.get('title'), config.get('description'))