]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/contv.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class CONtvIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?contv\.com/details-movie/(?P<id>[^/]+)'
14 'url': 'https://www.contv.com/details-movie/CEG10022949/days-of-thrills-&-laughter',
18 'title': 'Days Of Thrills & Laughter',
19 'description': 'md5:5d6b3d0b1829bb93eb72898c734802eb',
20 'upload_date': '20180703',
21 'timestamp': 1530634789.61,
25 'skip_download': True,
28 'url': 'https://www.contv.com/details-movie/CLIP-show_fotld_bts/fight-of-the-living-dead:-behind-the-scenes-bites',
30 'id': 'CLIP-show_fotld_bts',
31 'title': 'Fight of the Living Dead: Behind the Scenes Bites',
33 'playlist_mincount': 7,
36 def _real_extract(self
, url
):
37 video_id
= self
._match
_id
(url
)
38 details
= self
._download
_json
(
39 'http://metax.contv.live.junctiontv.net/metax/2.5/details/' + video_id
,
40 video_id
, query
={'device': 'web'})
42 if details
.get('type') == 'episodic':
43 seasons
= self
._download
_json
(
44 'http://metax.contv.live.junctiontv.net/metax/2.5/seriesfeed/json/' + video_id
,
47 for season
in seasons
:
48 for episode
in season
.get('episodes', []):
49 episode_id
= episode
.get('id')
52 entries
.append(self
.url_result(
53 'https://www.contv.com/details-movie/' + episode_id
,
54 CONtvIE
.ie_key(), episode_id
))
55 return self
.playlist_result(entries
, video_id
, details
.get('title'))
57 m_details
= details
['details']
58 title
= details
['title']
62 media_hls_url
= m_details
.get('media_hls_url')
64 formats
.extend(self
._extract
_m
3u8_formats
(
65 media_hls_url
, video_id
, 'mp4',
66 m3u8_id
='hls', fatal
=False))
68 media_mp4_url
= m_details
.get('media_mp4_url')
75 self
._sort
_formats
(formats
)
78 captions
= m_details
.get('captions') or {}
79 for caption_url
in captions
.values():
80 subtitles
.setdefault('en', []).append({
85 for image
in m_details
.get('images', []):
86 image_url
= image
.get('url')
91 'width': int_or_none(image
.get('width')),
92 'height': int_or_none(image
.get('height')),
96 for p
in ('large_', 'medium_', 'small_', ''):
97 d
= m_details
.get(p
+ 'description')
106 'thumbnails': thumbnails
,
107 'description': description
,
108 'timestamp': float_or_none(details
.get('metax_added_on'), 1000),
109 'subtitles': subtitles
,
110 'duration': float_or_none(m_details
.get('duration'), 1000),
111 'view_count': int_or_none(details
.get('num_watched')),
112 'like_count': int_or_none(details
.get('num_fav')),
113 'categories': details
.get('category'),
114 'tags': details
.get('tags'),
115 'season_number': int_or_none(details
.get('season')),
116 'episode_number': int_or_none(details
.get('episode')),
117 'release_year': int_or_none(details
.get('pub_year')),