2 from __future__ import unicode_literals
4 from .common import InfoExtractor
7 class HGTVComShowIE(InfoExtractor):
8 IE_NAME = 'hgtv.com:show'
9 _VALID_URL = r'https?://(?:www\.)?hgtv\.com/shows/[^/]+/(?P<id>[^/?#&]+)'
12 'url': 'http://www.hgtv.com/shows/flip-or-flop/flip-or-flop-full-episodes-season-4-videos',
14 'id': 'flip-or-flop-full-episodes-season-4-videos',
15 'title': 'Flip or Flop Full Episodes',
17 'playlist_mincount': 15,
19 # data-deferred-module="video"
20 'url': 'http://www.hgtv.com/shows/good-bones/episodes/an-old-victorian-house-gets-a-new-facelift',
21 'only_matching': True,
24 def _real_extract(self, url):
25 display_id = self._match_id(url)
27 webpage = self._download_webpage(url, display_id)
29 config = self._parse_json(
31 r'(?s)data-(?:deferred-)?module=["\']video["\'][^>]*>.*?<script[^>]+type=["\']text/x-config["\'][^>]*>(.+?)</script',
32 webpage, 'video config'),
33 display_id)['channels'][0]
36 self.url_result(video['releaseUrl'])
37 for video in config['videos'] if video.get('releaseUrl')]
39 return self.playlist_result(
40 entries, display_id, config.get('title'), config.get('description'))