diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index fb2672543..61f3b1ebb 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1341,11 +1341,7 @@ from .vk import ( VKUserVideosIE, VKWallPostIE, ) -from .vlaretv import ( - VlaretvIE, - VlaretvPlaylistIE -) - +from .vlaretv import VlaretvPlaylistIE from .vlive import ( VLiveIE, VLiveChannelIE, diff --git a/youtube_dl/extractor/vlaretv.py b/youtube_dl/extractor/vlaretv.py index a118120e7..900260ece 100644 --- a/youtube_dl/extractor/vlaretv.py +++ b/youtube_dl/extractor/vlaretv.py @@ -1,60 +1,12 @@ # coding: utf-8 from __future__ import unicode_literals - from .common import InfoExtractor +from ..utils import urljoin import re -class VlaretvIE(InfoExtractor): - _VALID_URL = r'https?:\/\/vlare.tv\/v\/(?P[0-9a-zA-Z]+)' - IE_NAME = 'vlare.tv' - _TESTS = [ - { - 'url': 'https://vlare.tv/v/cTQKAh0z', - 'info_dict': { - 'id': 'cTQKAh0z', - 'ext': 'mp4', - 'title': 'Interspecies Reviewers Abridged | One Shot (Parody)', - } - }, - { - 'url': 'https://vlare.tv/v/HSzfUoye', - 'info_dict': { - 'id': 'HSzfUoye', - 'ext': 'mp4', - 'title': 'Quake II (1997) - Gameplay AMD K6-III+ and 3dfx Voodoo Banshee', - } - }, - { - 'url': 'https://vlare.tv/v/t7XSuZfK/2568', - 'info_dict': { - 'id': 'HSzfUoye', - 'ext': 'mp4', - 'title': 'Quake II (1997) - Gameplay AMD K6-III+ and 3dfx Voodoo Banshee', - } - } - ] - - def _real_extract(self, url): - video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) - title = self._html_search_regex(r'(.+?)<\/title>', webpage, 'title').replace(' | Vlare', '') - video_urls = self._html_search_regex(r'sources: \[{"file":(.+?)\],', webpage, 'video_urls') - video_urls = video_urls.split(',') - video_urls_clean = [] - for i in video_urls: - if 'http' in i: - video_urls_clean.insert(0, {'url': i.replace("\"", "").replace("\n", "").replace("{file:", "")}) - return { - 'id': video_id, - 'title': title, - 'formats': video_urls_clean - } - - class VlaretvPlaylistIE(InfoExtractor): - _VALID_URL = r'https?://vlare.tv/u/(?P<Channel_id>[0-9a-zA-Z]+)/playlist/(?P<id>[0-9]+)' - IE_NAME = 'Vlare.tv Playlist' + _VALID_URL = r'https?://vlare\.tv/u/(?P<Channel_id>[0-9a-zA-Z]+)/playlist/(?P<id>[0-9]+)' _TEST = { 'url': 'https://vlare.tv/u/LVWDDFhi/playlist/2568', 'info_dict': { @@ -66,22 +18,11 @@ class VlaretvPlaylistIE(InfoExtractor): def _real_extract(self, url): playlist_id = self._match_id(url) - webpage = self._download_webpage(url, playlist_id) urls = re.findall(r'<a href="(.+?)" class="video_thumbnail"', webpage) - title = self._html_search_regex(r'<title>(.+?)<\/title>', webpage, 'title').split('|')[1][1:-1] - entries = [] - for i in urls: - entry = { - '_type': 'url_transparent', - 'url': 'https://vlare.tv' + i, - 'id': re.match(r'\/v\/(.+?)\/', i), - } - entries.append(entry) + title = self._html_search_regex(r'<title>(.+?) \| Vlare', webpage, 'title') + + # When playlist points to deleted video there is an "error" in the url (Ex. https://vlare.tv/v/error/3257) + entries = [self.url_result(urljoin('https://vlare.tv', u)) for u in urls if 'error' not in u] - return { - '_type': 'playlist', - 'title': title, - 'id': self._match_id(url), - 'entries': entries, - } + return self.playlist_result(entries, playlist_id, title)