[sproutvideo] Download multiple video in a single webpage

This commit is contained in:
thezero 2019-08-06 20:32:00 +02:00
parent 36071a8d06
commit c956f4a736
2 changed files with 9 additions and 13 deletions

View File

@ -3214,9 +3214,10 @@ class GenericIE(InfoExtractor):
return self.playlist_from_matches(
zype_urls, video_id, video_title, ie=ZypeIE.ie_key())
sproutvideo_url = SproutVideoIE._extract_url(webpage)
if sproutvideo_url:
return self.url_result(sproutvideo_url)
sproutvideo_urls = SproutVideoIE._extract_urls(webpage)
if sproutvideo_urls:
return self.playlist_from_matches(
sproutvideo_urls, video_id, video_title, ie=SproutVideoIE.ie_key())
# Look for HTML5 media
entries = self._parse_html5_media_entries(url, webpage, video_id, m3u8_id='hls')

View File

@ -25,16 +25,11 @@ class SproutVideoIE(InfoExtractor):
}
@staticmethod
def _extract_url(webpage):
sproutvideo = re.search(
r'(?:<iframe\s+class=[\'\"]sproutvideo-player.*src|href)=[\'\"](?P<url>(?:https?:|)%s[^\'\"]+)[\'\"]' % SproutVideoIE._NOSCHEMA_URL, webpage)
if sproutvideo:
video_url = sproutvideo.group('url')
# Fix the video URL if the iframe doesn't have a defined schema
if video_url[:2] == '//':
video_url = 'https:' + video_url
return video_url
def _extract_urls(webpage):
# Fix the video URL if the iframe doesn't have a defined schema
return [sprout.group('url') for sprout in re.finditer(
r'(?:<iframe\s+class=[\'\"]sproutvideo-player.*src|href)=[\'\"](?P<url>(?:https?:|)%s[^\'\"]+)[\'\"]' % SproutVideoIE._NOSCHEMA_URL,
webpage)]
def _real_extract(self, url):
video_id = self._match_id(url)