]>
Commit | Line | Data |
---|---|---|
f0d36694 | 1 | from .common import InfoExtractor |
4e9fee10 S |
2 | |
3 | ||
4 | class HGTVComShowIE(InfoExtractor): | |
5 | IE_NAME = 'hgtv.com:show' | |
6 | _VALID_URL = r'https?://(?:www\.)?hgtv\.com/shows/[^/]+/(?P<id>[^/?#&]+)' | |
fa3ea722 S |
7 | _TESTS = [{ |
8 | # data-module="video" | |
9 | 'url': 'http://www.hgtv.com/shows/flip-or-flop/flip-or-flop-full-episodes-season-4-videos', | |
4e9fee10 | 10 | 'info_dict': { |
fa3ea722 | 11 | 'id': 'flip-or-flop-full-episodes-season-4-videos', |
4e9fee10 S |
12 | 'title': 'Flip or Flop Full Episodes', |
13 | }, | |
14 | 'playlist_mincount': 15, | |
fa3ea722 S |
15 | }, { |
16 | # data-deferred-module="video" | |
17 | 'url': 'http://www.hgtv.com/shows/good-bones/episodes/an-old-victorian-house-gets-a-new-facelift', | |
18 | 'only_matching': True, | |
19 | }] | |
4e9fee10 S |
20 | |
21 | def _real_extract(self, url): | |
22 | display_id = self._match_id(url) | |
23 | ||
24 | webpage = self._download_webpage(url, display_id) | |
25 | ||
26 | config = self._parse_json( | |
27 | self._search_regex( | |
ac7409ee | 28 | r'(?s)data-(?:deferred-)?module=["\']video["\'][^>]*>.*?<script[^>]+type=["\']text/x-config["\'][^>]*>(.+?)</script', |
4e9fee10 S |
29 | webpage, 'video config'), |
30 | display_id)['channels'][0] | |
31 | ||
32 | entries = [ | |
33 | self.url_result(video['releaseUrl']) | |
34 | for video in config['videos'] if video.get('releaseUrl')] | |
35 | ||
36 | return self.playlist_result( | |
37 | entries, display_id, config.get('title'), config.get('description')) |