From 40d43e940cdf94c22e4ec9fe3a8b2ca2a9589115 Mon Sep 17 00:00:00 2001 From: Alex Seiler Date: Mon, 23 Oct 2017 21:15:48 +0200 Subject: [PATCH 1/6] [ellentube] Fix broken extractor (closes #14407) --- youtube_dl/extractor/ellentube.py | 114 +++++++++++++++++++++++++++++ youtube_dl/extractor/ellentv.py | 101 ------------------------- youtube_dl/extractor/extractors.py | 6 +- 3 files changed, 117 insertions(+), 104 deletions(-) create mode 100644 youtube_dl/extractor/ellentube.py delete mode 100644 youtube_dl/extractor/ellentv.py diff --git a/youtube_dl/extractor/ellentube.py b/youtube_dl/extractor/ellentube.py new file mode 100644 index 000000000..64276591e --- /dev/null +++ b/youtube_dl/extractor/ellentube.py @@ -0,0 +1,114 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + int_or_none, + urljoin, +) + + +class EllenTubeBaseIE(InfoExtractor): + API_URL = 'https://api-prod.ellentube.com/' + + def _extract_from_video_id(self, video_id, display_id=None): + video_data = self._download_json( + urljoin(self.API_URL, 'ellenapi/api/item/%s' % video_id), video_id) + title = video_data['title'] + description = video_data.get('description') + publish_time = int_or_none(video_data.get('publishTime')) + thumbnail = video_data.get('thumbnail') + + formats = [] + duration = None + for entry in video_data.get('media'): + if entry.get('id') == 'm3u8': + formats = self._extract_m3u8_formats(entry.get( + 'url'), video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') + duration = int_or_none(entry.get('duration')) + break + self._sort_formats(formats) + + return { + 'id': video_id, + 'title': title, + 'description': description, + 'display_id': display_id, + 'duration': duration, + 'thumbnail': thumbnail, + 'timestamp': publish_time, + 'formats': formats, + } + + def _extract_video_ids_from_api_search(self, api_search, display_id): + feed_data = self._download_json( + urljoin(self.API_URL, 'ellenapi/api/feed/?%s' % api_search), display_id) + return [entry.get('id') for entry in feed_data if entry.get('type') == 'VIDEO'] + + +class EllenTubeVideoIE(EllenTubeBaseIE): + _VALID_URL = r'https?://(?:www\.)?ellentube\.com/video/(?P.+)\.html' + + _TEST = { + 'url': 'https://www.ellentube.com/video/ellen-meets-las-vegas-survivors-jesus-campos-and-stephen-schuck.html', + 'md5': '2fabc277131bddafdd120e0fc0f974c9', + 'info_dict': { + 'id': '0822171c-3829-43bf-b99f-d77358ae75e3', + 'ext': 'mp4', + 'title': 'Ellen Meets Las Vegas Survivors Jesus Campos and Stephen Schuck', + 'description': 'md5:76e3355e2242a78ad9e3858e5616923f', + 'display_id': 'ellen-meets-las-vegas-survivors-jesus-campos-and-stephen-schuck', + 'duration': 514, + 'timestamp': 1508505120000, + 'thumbnail': 'https://warnerbros-h.assetsadobe.com/is/image/content/dam/ellen/videos/episodes/season15/32/video--2728751654987218111', + } + } + + def _real_extract(self, url): + display_id = self._match_id(url) + webpage = self._download_webpage(url, display_id) + video_id_regex = r'data-config.+([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})' + video_id = self._search_regex(video_id_regex, webpage, 'video id') + return self._extract_from_video_id(video_id, display_id) + + +class EllenTubePlaylistIE(EllenTubeBaseIE): + _VALID_URL = r'https?://(?:www\.)?ellentube\.com/(?:episode|studios)/(?P.+)\.html' + + _TESTS = [{ + 'url': 'https://www.ellentube.com/episode/dax-shepard-jordan-fisher-haim.html', + 'info_dict': { + 'id': 'dax-shepard-jordan-fisher-haim', + 'title': 'Dax Shepard, \'DWTS\' Team Jordan Fisher & Lindsay Arnold, HAIM', + }, + 'playlist_count': 6, + }, { + 'url': 'https://www.ellentube.com/studios/macey-goes-rving0.html', + 'info_dict': { + 'id': 'macey-goes-rving0', + 'title': 'Macey Goes RVing', + }, + 'playlist_mincount': 3, + }] + + def _real_extract(self, url): + display_id = self._match_id(url) + webpage = self._download_webpage(url, display_id) + + playlist_data = self._html_search_regex( + r'', webpage, 'episode data') + playlist_title = self._search_regex( + r'title"\s*:\s*"(.+?)"', playlist_data, 'playlist title') + entries = [self._extract_from_video_id(m.group('vid')) for m in re.finditer( + r'pid=(?P[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})', playlist_data)] + if not entries: + api_search = self._search_regex( + r'filter"\s*:\s*"(.+?)"', playlist_data, 'api search') + video_ids = self._extract_video_ids_from_api_search( + api_search, display_id) + entries = [self._extract_from_video_id( + vid, display_id) for vid in video_ids] + + return self.playlist_result(entries, display_id, playlist_title) diff --git a/youtube_dl/extractor/ellentv.py b/youtube_dl/extractor/ellentv.py deleted file mode 100644 index e0a13dd76..000000000 --- a/youtube_dl/extractor/ellentv.py +++ /dev/null @@ -1,101 +0,0 @@ -# coding: utf-8 -from __future__ import unicode_literals - -from .common import InfoExtractor -from .kaltura import KalturaIE -from ..utils import NO_DEFAULT - - -class EllenTVIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?(?:ellentv|ellentube)\.com/videos/(?P[a-z0-9_-]+)' - _TESTS = [{ - 'url': 'http://www.ellentv.com/videos/0-ipq1gsai/', - 'md5': '4294cf98bc165f218aaa0b89e0fd8042', - 'info_dict': { - 'id': '0_ipq1gsai', - 'ext': 'mov', - 'title': 'Fast Fingers of Fate', - 'description': 'md5:3539013ddcbfa64b2a6d1b38d910868a', - 'timestamp': 1428035648, - 'upload_date': '20150403', - 'uploader_id': 'batchUser', - }, - }, { - # not available via http://widgets.ellentube.com/ - 'url': 'http://www.ellentv.com/videos/1-szkgu2m2/', - 'info_dict': { - 'id': '1_szkgu2m2', - 'ext': 'flv', - 'title': "Ellen's Amazingly Talented Audience", - 'description': 'md5:86ff1e376ff0d717d7171590e273f0a5', - 'timestamp': 1255140900, - 'upload_date': '20091010', - 'uploader_id': 'ellenkaltura@gmail.com', - }, - 'params': { - 'skip_download': True, - }, - }] - - def _real_extract(self, url): - video_id = self._match_id(url) - - URLS = ('http://widgets.ellentube.com/videos/%s' % video_id, url) - - for num, url_ in enumerate(URLS, 1): - webpage = self._download_webpage( - url_, video_id, fatal=num == len(URLS)) - - default = NO_DEFAULT if num == len(URLS) else None - - partner_id = self._search_regex( - r"var\s+partnerId\s*=\s*'([^']+)", webpage, 'partner id', - default=default) - - kaltura_id = self._search_regex( - [r'id="kaltura_player_([^"]+)"', - r"_wb_entry_id\s*:\s*'([^']+)", - r'data-kaltura-entry-id="([^"]+)'], - webpage, 'kaltura id', default=default) - - if partner_id and kaltura_id: - break - - return self.url_result('kaltura:%s:%s' % (partner_id, kaltura_id), KalturaIE.ie_key()) - - -class EllenTVClipsIE(InfoExtractor): - IE_NAME = 'EllenTV:clips' - _VALID_URL = r'https?://(?:www\.)?ellentv\.com/episodes/(?P[a-z0-9_-]+)' - _TEST = { - 'url': 'http://www.ellentv.com/episodes/meryl-streep-vanessa-hudgens/', - 'info_dict': { - 'id': 'meryl-streep-vanessa-hudgens', - 'title': 'Meryl Streep, Vanessa Hudgens', - }, - 'playlist_mincount': 5, - } - - def _real_extract(self, url): - playlist_id = self._match_id(url) - - webpage = self._download_webpage(url, playlist_id) - playlist = self._extract_playlist(webpage, playlist_id) - - return { - '_type': 'playlist', - 'id': playlist_id, - 'title': self._og_search_title(webpage), - 'entries': self._extract_entries(playlist) - } - - def _extract_playlist(self, webpage, playlist_id): - json_string = self._search_regex(r'playerView.addClips\(\[\{(.*?)\}\]\);', webpage, 'json') - return self._parse_json('[{' + json_string + '}]', playlist_id) - - def _extract_entries(self, playlist): - return [ - self.url_result( - 'kaltura:%s:%s' % (item['kaltura_partner_id'], item['kaltura_entry_id']), - KalturaIE.ie_key(), video_id=item['kaltura_entry_id']) - for item in playlist] diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 09b20a39a..cb92475c7 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -308,9 +308,9 @@ from .ehow import EHowIE from .eighttracks import EightTracksIE from .einthusan import EinthusanIE from .eitb import EitbIE -from .ellentv import ( - EllenTVIE, - EllenTVClipsIE, +from .ellentube import ( + EllenTubePlaylistIE, + EllenTubeVideoIE, ) from .elpais import ElPaisIE from .embedly import EmbedlyIE From 061b47ce7126b1d4d2fa7bcd399d5f029f1d4a4a Mon Sep 17 00:00:00 2001 From: Alex Seiler Date: Thu, 26 Oct 2017 04:09:00 +0200 Subject: [PATCH 2/6] [ellentube] Break loop after video was found --- youtube_dl/extractor/ellentube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/ellentube.py b/youtube_dl/extractor/ellentube.py index 64276591e..c29cbe166 100644 --- a/youtube_dl/extractor/ellentube.py +++ b/youtube_dl/extractor/ellentube.py @@ -28,7 +28,7 @@ class EllenTubeBaseIE(InfoExtractor): formats = self._extract_m3u8_formats(entry.get( 'url'), video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') duration = int_or_none(entry.get('duration')) - break + break self._sort_formats(formats) return { From 5d81166f786faf937a14bed43be18d715f220922 Mon Sep 17 00:00:00 2001 From: Alex Seiler Date: Mon, 30 Oct 2017 01:47:49 +0100 Subject: [PATCH 3/6] [ellentube] Improve extraction of playlists. Instead of searching the webpage for video ids and making a api request for each video id, we now make one single api request to get all the required information needed to extract a playlist. --- youtube_dl/extractor/ellentube.py | 88 +++++++++++++++++------------- youtube_dl/extractor/extractors.py | 3 +- 2 files changed, 52 insertions(+), 39 deletions(-) diff --git a/youtube_dl/extractor/ellentube.py b/youtube_dl/extractor/ellentube.py index c29cbe166..d4f07f34f 100644 --- a/youtube_dl/extractor/ellentube.py +++ b/youtube_dl/extractor/ellentube.py @@ -1,10 +1,9 @@ # coding: utf-8 from __future__ import unicode_literals -import re - from .common import InfoExtractor from ..utils import ( + clean_html, int_or_none, urljoin, ) @@ -13,24 +12,21 @@ from ..utils import ( class EllenTubeBaseIE(InfoExtractor): API_URL = 'https://api-prod.ellentube.com/' - def _extract_from_video_id(self, video_id, display_id=None): - video_data = self._download_json( - urljoin(self.API_URL, 'ellenapi/api/item/%s' % video_id), video_id) - title = video_data['title'] - description = video_data.get('description') - publish_time = int_or_none(video_data.get('publishTime')) - thumbnail = video_data.get('thumbnail') + def _extract_video_from_json(self, data, video_id, display_id=None): + title = data['title'] + description = data.get('description') + publish_time = int_or_none(data.get('publishTime')) + thumbnail = data.get('thumbnail') formats = [] duration = None - for entry in video_data.get('media'): + for entry in data.get('media'): if entry.get('id') == 'm3u8': - formats = self._extract_m3u8_formats(entry.get( - 'url'), video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') + formats = self._extract_m3u8_formats( + entry.get('url'), video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') duration = int_or_none(entry.get('duration')) break self._sort_formats(formats) - return { 'id': video_id, 'title': title, @@ -42,10 +38,31 @@ class EllenTubeBaseIE(InfoExtractor): 'formats': formats, } - def _extract_video_ids_from_api_search(self, api_search, display_id): - feed_data = self._download_json( + def _extract_playlist_entries_from_json(self, data, display_id): + return [self._extract_video_from_json(elem, elem['id']) + for elem in data if elem.get('type') == 'VIDEO'] + + def _extract_from_video_id(self, video_id, display_id=None): + api_data = self._download_json( + urljoin(self.API_URL, 'ellenapi/api/item/%s' % video_id), video_id) + return self._extract_video_from_json(api_data, video_id, display_id) + + def _extract_playlist(self, url, display_id, extract_description=True): + webpage = self._download_webpage(url, display_id) + playlist_data = self._html_search_regex( + r'', webpage, 'playlist data') + playlist_title = self._search_regex( + r'"title"\s*:\s*"(.+?)"', playlist_data, 'playlist title') + playlist_description = clean_html(self._search_regex( + r'"description"\s*:\s*"(.+?)"', playlist_data, 'playlist description', + fatal=False)) if extract_description else None + api_search = self._search_regex( + r'"filter"\s*:\s*"(.+?)"', playlist_data, 'playlist api request') + api_data = self._download_json( urljoin(self.API_URL, 'ellenapi/api/feed/?%s' % api_search), display_id) - return [entry.get('id') for entry in feed_data if entry.get('type') == 'VIDEO'] + return self.playlist_result( + self._extract_playlist_entries_from_json(api_data, display_id), + display_id, playlist_title, playlist_description) class EllenTubeVideoIE(EllenTubeBaseIE): @@ -74,41 +91,36 @@ class EllenTubeVideoIE(EllenTubeBaseIE): return self._extract_from_video_id(video_id, display_id) -class EllenTubePlaylistIE(EllenTubeBaseIE): - _VALID_URL = r'https?://(?:www\.)?ellentube\.com/(?:episode|studios)/(?P.+)\.html' +class EllenTubeEpisodeIE(EllenTubeBaseIE): + _VALID_URL = r'https?://(?:www\.)?ellentube\.com/episode/(?P.+)\.html' - _TESTS = [{ + _TEST = { 'url': 'https://www.ellentube.com/episode/dax-shepard-jordan-fisher-haim.html', 'info_dict': { 'id': 'dax-shepard-jordan-fisher-haim', 'title': 'Dax Shepard, \'DWTS\' Team Jordan Fisher & Lindsay Arnold, HAIM', + 'description': 'md5:aed85d42892f6126e71ec5ed2aea2a0d' }, 'playlist_count': 6, - }, { + } + + def _real_extract(self, url): + display_id = self._match_id(url) + return self._extract_playlist(url, display_id) + + +class EllenTubeStudioIE(EllenTubeBaseIE): + _VALID_URL = r'https?://(?:www\.)?ellentube\.com/studios/(?P.+)\.html' + + _TEST = { 'url': 'https://www.ellentube.com/studios/macey-goes-rving0.html', 'info_dict': { 'id': 'macey-goes-rving0', 'title': 'Macey Goes RVing', }, 'playlist_mincount': 3, - }] + } def _real_extract(self, url): display_id = self._match_id(url) - webpage = self._download_webpage(url, display_id) - - playlist_data = self._html_search_regex( - r'', webpage, 'episode data') - playlist_title = self._search_regex( - r'title"\s*:\s*"(.+?)"', playlist_data, 'playlist title') - entries = [self._extract_from_video_id(m.group('vid')) for m in re.finditer( - r'pid=(?P[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})', playlist_data)] - if not entries: - api_search = self._search_regex( - r'filter"\s*:\s*"(.+?)"', playlist_data, 'api search') - video_ids = self._extract_video_ids_from_api_search( - api_search, display_id) - entries = [self._extract_from_video_id( - vid, display_id) for vid in video_ids] - - return self.playlist_result(entries, display_id, playlist_title) + return self._extract_playlist(url, display_id, False) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index cb92475c7..ac75607fe 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -309,7 +309,8 @@ from .eighttracks import EightTracksIE from .einthusan import EinthusanIE from .eitb import EitbIE from .ellentube import ( - EllenTubePlaylistIE, + EllenTubeEpisodeIE, + EllenTubeStudioIE, EllenTubeVideoIE, ) from .elpais import ElPaisIE From 196b0d7a36372e549abbbd8c2727a908d981e11a Mon Sep 17 00:00:00 2001 From: Alex Seiler Date: Tue, 7 Nov 2017 01:08:05 +0100 Subject: [PATCH 4/6] [ellentube] Extract the correct video id --- youtube_dl/extractor/ellentube.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/ellentube.py b/youtube_dl/extractor/ellentube.py index d4f07f34f..175d2e62f 100644 --- a/youtube_dl/extractor/ellentube.py +++ b/youtube_dl/extractor/ellentube.py @@ -86,8 +86,9 @@ class EllenTubeVideoIE(EllenTubeBaseIE): def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) - video_id_regex = r'data-config.+([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})' - video_id = self._search_regex(video_id_regex, webpage, 'video id') + video_id = self._html_search_regex( + r'(?s).*data-config.+([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})', + webpage, 'video id') return self._extract_from_video_id(video_id, display_id) From 6d006044bc46a67f891c971b3aece0f5706cda9c Mon Sep 17 00:00:00 2001 From: Alexander Seiler Date: Wed, 15 Nov 2017 18:18:31 +0100 Subject: [PATCH 5/6] [ellentube] Implement code review changes. --- youtube_dl/extractor/ellentube.py | 99 +++++++++++++++++------------- youtube_dl/extractor/extractors.py | 1 + 2 files changed, 57 insertions(+), 43 deletions(-) diff --git a/youtube_dl/extractor/ellentube.py b/youtube_dl/extractor/ellentube.py index 175d2e62f..1c0406ee4 100644 --- a/youtube_dl/extractor/ellentube.py +++ b/youtube_dl/extractor/ellentube.py @@ -5,14 +5,31 @@ from .common import InfoExtractor from ..utils import ( clean_html, int_or_none, - urljoin, ) -class EllenTubeBaseIE(InfoExtractor): - API_URL = 'https://api-prod.ellentube.com/' +class EllenTubeIE(InfoExtractor): + _VALID_URL = r'''(?x) + (?: + https://api-prod\.ellentube\.com/ellenapi/api/item/ + |ellentube: + ) + (?P + [\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12} + )''' - def _extract_video_from_json(self, data, video_id, display_id=None): + _TESTS = [{ + 'url': 'https://api-prod.ellentube.com/ellenapi/api/item/75c64c16-aefd-4558-b4f5-3de09b22e6fc', + 'match_only': True, + }, { + 'url': 'ellentube:734a3353-f697-4e79-9ca9-bfc3002dc1e0', + 'match_only': True, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + data = self._download_json( + 'https://api-prod.ellentube.com/ellenapi/api/item/%s' % video_id, video_id) title = data['title'] description = data.get('description') publish_time = int_or_none(data.get('publishTime')) @@ -31,21 +48,43 @@ class EllenTubeBaseIE(InfoExtractor): 'id': video_id, 'title': title, 'description': description, - 'display_id': display_id, 'duration': duration, 'thumbnail': thumbnail, 'timestamp': publish_time, 'formats': formats, } - def _extract_playlist_entries_from_json(self, data, display_id): - return [self._extract_video_from_json(elem, elem['id']) - for elem in data if elem.get('type') == 'VIDEO'] - def _extract_from_video_id(self, video_id, display_id=None): - api_data = self._download_json( - urljoin(self.API_URL, 'ellenapi/api/item/%s' % video_id), video_id) - return self._extract_video_from_json(api_data, video_id, display_id) +class EllenTubeVideoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?ellentube\.com/video/(?P.+)\.html' + + _TEST = { + 'url': 'https://www.ellentube.com/video/ellen-meets-las-vegas-survivors-jesus-campos-and-stephen-schuck.html', + 'md5': '2fabc277131bddafdd120e0fc0f974c9', + 'info_dict': { + 'id': '0822171c-3829-43bf-b99f-d77358ae75e3', + 'ext': 'mp4', + 'title': 'Ellen Meets Las Vegas Survivors Jesus Campos and Stephen Schuck', + 'description': 'md5:76e3355e2242a78ad9e3858e5616923f', + 'duration': 514, + 'timestamp': 1508505120000, + 'thumbnail': 'https://warnerbros-h.assetsadobe.com/is/image/content/dam/ellen/videos/episodes/season15/32/video--2728751654987218111', + } + } + + def _real_extract(self, url): + display_id = self._match_id(url) + webpage = self._download_webpage(url, display_id) + video_id = self._html_search_regex( + r'(?s).*data-config.+([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})', + webpage, 'video id') + return self.url_result('ellentube:%s' % video_id) + + +class EllenTubePlaylistIE(InfoExtractor): + def _extract_videos_from_json(self, data, display_id): + return [self.url_result('ellentube:%s' % elem['id'], 'EllenTube') + for elem in data if elem.get('type') == 'VIDEO'] def _extract_playlist(self, url, display_id, extract_description=True): webpage = self._download_webpage(url, display_id) @@ -59,40 +98,14 @@ class EllenTubeBaseIE(InfoExtractor): api_search = self._search_regex( r'"filter"\s*:\s*"(.+?)"', playlist_data, 'playlist api request') api_data = self._download_json( - urljoin(self.API_URL, 'ellenapi/api/feed/?%s' % api_search), display_id) + 'https://api-prod.ellentube.com/ellenapi/api/feed/?%s' % api_search, + display_id) return self.playlist_result( - self._extract_playlist_entries_from_json(api_data, display_id), + self._extract_videos_from_json(api_data, display_id), display_id, playlist_title, playlist_description) -class EllenTubeVideoIE(EllenTubeBaseIE): - _VALID_URL = r'https?://(?:www\.)?ellentube\.com/video/(?P.+)\.html' - - _TEST = { - 'url': 'https://www.ellentube.com/video/ellen-meets-las-vegas-survivors-jesus-campos-and-stephen-schuck.html', - 'md5': '2fabc277131bddafdd120e0fc0f974c9', - 'info_dict': { - 'id': '0822171c-3829-43bf-b99f-d77358ae75e3', - 'ext': 'mp4', - 'title': 'Ellen Meets Las Vegas Survivors Jesus Campos and Stephen Schuck', - 'description': 'md5:76e3355e2242a78ad9e3858e5616923f', - 'display_id': 'ellen-meets-las-vegas-survivors-jesus-campos-and-stephen-schuck', - 'duration': 514, - 'timestamp': 1508505120000, - 'thumbnail': 'https://warnerbros-h.assetsadobe.com/is/image/content/dam/ellen/videos/episodes/season15/32/video--2728751654987218111', - } - } - - def _real_extract(self, url): - display_id = self._match_id(url) - webpage = self._download_webpage(url, display_id) - video_id = self._html_search_regex( - r'(?s).*data-config.+([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})', - webpage, 'video id') - return self._extract_from_video_id(video_id, display_id) - - -class EllenTubeEpisodeIE(EllenTubeBaseIE): +class EllenTubeEpisodeIE(EllenTubePlaylistIE): _VALID_URL = r'https?://(?:www\.)?ellentube\.com/episode/(?P.+)\.html' _TEST = { @@ -110,7 +123,7 @@ class EllenTubeEpisodeIE(EllenTubeBaseIE): return self._extract_playlist(url, display_id) -class EllenTubeStudioIE(EllenTubeBaseIE): +class EllenTubeStudioIE(EllenTubePlaylistIE): _VALID_URL = r'https?://(?:www\.)?ellentube\.com/studios/(?P.+)\.html' _TEST = { diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index ac75607fe..c47002c54 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -309,6 +309,7 @@ from .eighttracks import EightTracksIE from .einthusan import EinthusanIE from .eitb import EitbIE from .ellentube import ( + EllenTubeIE, EllenTubeEpisodeIE, EllenTubeStudioIE, EllenTubeVideoIE, From 572292fcc4eba8e937cf5d17b9a00f21799f9a72 Mon Sep 17 00:00:00 2001 From: Alexander Seiler Date: Wed, 15 Nov 2017 18:21:52 +0100 Subject: [PATCH 6/6] [ellentube] Add ie to url_result --- youtube_dl/extractor/ellentube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/ellentube.py b/youtube_dl/extractor/ellentube.py index 1c0406ee4..68fe17273 100644 --- a/youtube_dl/extractor/ellentube.py +++ b/youtube_dl/extractor/ellentube.py @@ -78,7 +78,7 @@ class EllenTubeVideoIE(InfoExtractor): video_id = self._html_search_regex( r'(?s).*data-config.+([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})', webpage, 'video id') - return self.url_result('ellentube:%s' % video_id) + return self.url_result('ellentube:%s' % video_id, 'EllenTube') class EllenTubePlaylistIE(InfoExtractor):