1 from .common
import InfoExtractor
11 class EllenTubeBaseIE(InfoExtractor
):
12 def _extract_data_config(self
, webpage
, video_id
):
13 details
= self
._search
_regex
(
14 r
'(<[^>]+\bdata-component=(["\'])[Dd
]etails
.+?
></div
>)', webpage,
16 return self._parse_json(
17 extract_attributes(details)['data
-config
'], video_id)
19 def _extract_video(self, data, video_id):
24 for entry in data.get('media
'):
25 if entry.get('id') == 'm3u8
':
26 formats, subtitles = self._extract_m3u8_formats_and_subtitles(
27 entry['url
'], video_id, 'mp4
',
28 entry_protocol='m3u8_native
', m3u8_id='hls
')
29 duration = int_or_none(entry.get('duration
'))
32 def get_insight(kind):
33 return int_or_none(try_get(
34 data, lambda x: x['insight
']['%ss' % kind]))
37 'extractor_key
': EllenTubeIE.ie_key(),
40 'description
': data.get('description
'),
42 'thumbnail
': data.get('thumbnail
'),
43 'timestamp
': float_or_none(data.get('publishTime
'), scale=1000),
44 'view_count
': get_insight('view
'),
45 'like_count
': get_insight('like
'),
47 'subtitles
': subtitles,
51 class EllenTubeIE(EllenTubeBaseIE):
55 https://api-prod\.ellentube\.com/ellenapi/api/item/
57 (?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})
60 'url
': 'https
://api
-prod
.ellentube
.com
/ellenapi
/api
/item
/0822171c
-3829-43bf
-b99f
-d77358ae75e3
',
61 'md5
': '2fabc277131bddafdd120e0fc0f974c9
',
63 'id': '0822171c
-3829-43bf
-b99f
-d77358ae75e3
',
65 'title
': 'Ellen Meets Las Vegas Survivors Jesus Campos
and Stephen Schuck
',
66 'description
': 'md5
:76e3355e2242a78ad9e3858e5616923f
',
67 'thumbnail
': r're
:^https?
://.+?
',
69 'timestamp
': 1508505120,
70 'upload_date
': '20171020',
75 'url
': 'ellentube
:734a3353
-f697
-4e79
-9ca9
-bfc3002dc1e0
',
76 'only_matching
': True,
79 def _real_extract(self, url):
80 video_id = self._match_id(url)
81 data = self._download_json(
82 'https
://api
-prod
.ellentube
.com
/ellenapi
/api
/item
/%s' % video_id,
84 return self._extract_video(data, video_id)
87 class EllenTubeVideoIE(EllenTubeBaseIE):
88 _VALID_URL = r'https?
://(?
:www\
.)?ellentube\
.com
/video
/(?P
<id>.+?
)\
.html
'
90 'url
': 'https
://www
.ellentube
.com
/video
/ellen
-meets
-las
-vegas
-survivors
-jesus
-campos
-and-stephen
-schuck
.html
',
91 'only_matching
': True,
94 def _real_extract(self, url):
95 display_id = self._match_id(url)
96 webpage = self._download_webpage(url, display_id)
97 video_id = self._extract_data_config(webpage, display_id)['id']
98 return self.url_result(
99 'ellentube
:%s' % video_id, ie=EllenTubeIE.ie_key(),
103 class EllenTubePlaylistIE(EllenTubeBaseIE):
104 _VALID_URL = r'https?
://(?
:www\
.)?ellentube\
.com
/(?
:episode|studios
)/(?P
<id>.+?
)\
.html
'
106 'url
': 'https
://www
.ellentube
.com
/episode
/dax
-shepard
-jordan
-fisher
-haim
.html
',
108 'id': 'dax
-shepard
-jordan
-fisher
-haim
',
109 'title
': "Dax Shepard, 'DWTS
' Team Jordan Fisher & Lindsay Arnold, HAIM",
110 'description
': 'md5
:bfc982194dabb3f4e325e43aa6b2e21c
',
114 'url
': 'https
://www
.ellentube
.com
/studios
/macey
-goes
-rving0
.html
',
115 'only_matching
': True,
118 def _real_extract(self, url):
119 display_id = self._match_id(url)
120 webpage = self._download_webpage(url, display_id)
121 data = self._extract_data_config(webpage, display_id)['data
']
122 feed = self._download_json(
123 'https
://api
-prod
.ellentube
.com
/ellenapi
/api
/feed
/?
%s'
124 % data['filter'], display_id)
126 self._extract_video(elem, elem['id'])
127 for elem in feed if elem.get('type') == 'VIDEO
' and elem.get('id')]
128 return self.playlist_result(
129 entries, display_id, data.get('title
'),
130 clean_html(data.get('description
')))