]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/hgtv.py
Update changelog.
[youtubedl] / youtube_dl / extractor / hgtv.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import (
6 int_or_none,
7 js_to_json,
8 smuggle_url,
9 )
10
11
12 class HGTVIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?hgtv\.ca/[^/]+/video/(?P<id>[^/]+)/video.html'
14 _TEST = {
15 'url': 'http://www.hgtv.ca/homefree/video/overnight-success/video.html?v=738081859718&p=1&s=da#video',
16 'md5': '',
17 'info_dict': {
18 'id': 'aFH__I_5FBOX',
19 'ext': 'mp4',
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',
25 },
26 'params': {
27 # m3u8 download
28 'skip_download': True,
29 },
30 }
31
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)
38 return {
39 '_type': 'url_transparent',
40 'url': smuggle_url(
41 'http://link.theplatform.com/s/dtjsEC/%s?mbr=true&manifest=m3u' % embed_vars['pid'], {
42 'force_smil_url': True
43 }),
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',
48 }