]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/hgtv.py
69543bff2cb3c844b8ebe82d38cd33672e168bbe
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
12 class HGTVIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?hgtv\.ca/[^/]+/video/(?P<id>[^/]+)/video.html'
15 'url': 'http://www.hgtv.ca/homefree/video/overnight-success/video.html?v=738081859718&p=1&s=da#video',
20 'title': 'Overnight Success',
21 'description': 'After weeks of hard work, high stakes, breakdowns and pep talks, the final 2 contestants compete to win the ultimate dream.',
22 'uploader': 'SHWM-NEW',
23 'timestamp': 1470320034,
24 'upload_date': '20160804',
28 'skip_download': True,
32 def _real_extract(self
, url
):
33 display_id
= self
._match
_id
(url
)
34 webpage
= self
._download
_webpage
(url
, display_id
)
35 embed_vars
= self
._parse
_json
(self
._search
_regex
(
36 r
'(?s)embed_vars\s*=\s*({.*?});',
37 webpage
, 'embed vars'), display_id
, js_to_json
)
39 '_type': 'url_transparent',
41 'http://link.theplatform.com/s/dtjsEC/%s?mbr=true&manifest=m3u' % embed_vars
['pid'], {
42 'force_smil_url': True
44 'series': embed_vars
.get('show'),
45 'season_number': int_or_none(embed_vars
.get('season')),
46 'episode_number': int_or_none(embed_vars
.get('episode')),
47 'ie_key': 'ThePlatform',
51 class HGTVComShowIE(InfoExtractor
):
52 IE_NAME
= 'hgtv.com:show'
53 _VALID_URL
= r
'https?://(?:www\.)?hgtv\.com/shows/[^/]+/(?P<id>[^/?#&]+)'
55 'url': 'http://www.hgtv.com/shows/flip-or-flop/flip-or-flop-full-episodes-videos',
57 'id': 'flip-or-flop-full-episodes-videos',
58 'title': 'Flip or Flop Full Episodes',
60 'playlist_mincount': 15,
63 def _real_extract(self
, url
):
64 display_id
= self
._match
_id
(url
)
66 webpage
= self
._download
_webpage
(url
, display_id
)
68 config
= self
._parse
_json
(
70 r
'(?s)data-module=["\']video
["\'][^>]*>.*?<script[^>]+type=["\']text
/x
-config
["\'][^>]*>(.+?)</script',
71 webpage, 'video config'),
72 display_id)['channels'][0]
75 self.url_result(video['releaseUrl'])
76 for video in config['videos'] if video.get('releaseUrl')]
78 return self.playlist_result(
79 entries, display_id, config.get('title'), config.get('description'))