]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/trutv.py
2 from __future__
import unicode_literals
6 from .turner
import TurnerBaseIE
13 class TruTVIE(TurnerBaseIE
):
14 _VALID_URL
= r
'https?://(?:www\.)?trutv\.com/(?:shows|full-episodes)/(?P<series_slug>[0-9A-Za-z-]+)/(?:videos/(?P<clip_slug>[0-9A-Za-z-]+)|(?P<id>\d+))'
16 'url': 'https://www.trutv.com/shows/the-carbonaro-effect/videos/sunlight-activated-flower.html',
18 'id': 'f16c03beec1e84cd7d1a51f11d8fcc29124cc7f1',
20 'title': 'Sunlight-Activated Flower',
21 'description': "A customer is stunned when he sees Michael's sunlight-activated flower.",
25 'skip_download': True,
29 def _real_extract(self
, url
):
30 series_slug
, clip_slug
, video_id
= re
.match(self
._VALID
_URL
, url
).groups()
37 display_id
= clip_slug
39 data
= self
._download
_json
(
40 'https://api.trutv.com/v2/web/%s/%s/%s' % (path
, series_slug
, display_id
),
42 video_data
= data
['episode'] if video_id
else data
['info']
43 media_id
= video_data
['mediaId']
44 title
= video_data
['title'].strip()
46 info
= self
._extract
_ngtv
_info
(
50 'auth_required': video_data
.get('isAuthRequired'),
54 for image
in video_data
.get('images', []):
55 image_url
= image
.get('srcUrl')
60 'width': int_or_none(image
.get('width')),
61 'height': int_or_none(image
.get('height')),
66 'display_id': display_id
,
68 'description': video_data
.get('description'),
69 'thumbnails': thumbnails
,
70 'timestamp': parse_iso8601(video_data
.get('publicationDate')),
71 'series': video_data
.get('showTitle'),
72 'season_number': int_or_none(video_data
.get('seasonNum')),
73 'episode_number': int_or_none(video_data
.get('episodeNum')),