[ie/twitter:spaces] Support video spaces (#10789)
[yt-dlp3.git] / yt_dlp / extractor / hgtv.py
blobc40017db185e7b0e5a1963365dd40b1b5cf766e6
1 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 _TESTS = [{
8 # data-module="video"
9 'url': 'http://www.hgtv.com/shows/flip-or-flop/flip-or-flop-full-episodes-season-4-videos',
10 'info_dict': {
11 'id': 'flip-or-flop-full-episodes-season-4-videos',
12 'title': 'Flip or Flop Full Episodes',
14 'playlist_mincount': 15,
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,
21 def _real_extract(self, url):
22 display_id = self._match_id(url)
24 webpage = self._download_webpage(url, display_id)
26 config = self._parse_json(
27 self._search_regex(
28 r'(?s)data-(?:deferred-)?module=["\']video["\'][^>]*>.*?<script[^>]+type=["\']text/x-config["\'][^>]*>(.+?)</script',
29 webpage, 'video config'),
30 display_id)['channels'][0]
32 entries = [
33 self.url_result(video['releaseUrl'])
34 for video in config['videos'] if video.get('releaseUrl')]
36 return self.playlist_result(
37 entries, display_id, config.get('title'), config.get('description'))