[generic] Simplify playlist support (#2948)
parent
be843678b1
commit
ed2d6a1960
|
@ -16,6 +16,7 @@ from ..utils import (
|
||||||
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
HEADRequest,
|
HEADRequest,
|
||||||
|
orderedSet,
|
||||||
parse_xml,
|
parse_xml,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
|
@ -292,15 +293,17 @@ class GenericIE(InfoExtractor):
|
||||||
# YouTube embed via <data-embed-url="">
|
# YouTube embed via <data-embed-url="">
|
||||||
{
|
{
|
||||||
'url': 'https://play.google.com/store/apps/details?id=com.gameloft.android.ANMP.GloftA8HM',
|
'url': 'https://play.google.com/store/apps/details?id=com.gameloft.android.ANMP.GloftA8HM',
|
||||||
'md5': 'c267b1ab6d736057d64babaa37e07a66',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'Ybd-qmqYYpA',
|
'id': 'jpSGZsgga_I',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Asphalt 8: Airborne - Chinese Great Wall - Android Game Trailer',
|
'title': 'Asphalt 8: Airborne - Launch Trailer',
|
||||||
'uploader': 'gameloftandroid',
|
'uploader': 'Gameloft',
|
||||||
'uploader_id': 'gameloftandroid',
|
'uploader_id': 'gameloft',
|
||||||
'upload_date': '20140321',
|
'upload_date': '20130821',
|
||||||
'description': 'md5:9c6dca5dd75b7131ce482ccf080749d6'
|
'description': 'md5:87bd95f13d8be3e7da87a5f2c443106a',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -493,6 +496,12 @@ class GenericIE(InfoExtractor):
|
||||||
video_uploader = self._search_regex(
|
video_uploader = self._search_regex(
|
||||||
r'^(?:https?://)?([^/]*)/.*', url, 'video uploader')
|
r'^(?:https?://)?([^/]*)/.*', url, 'video uploader')
|
||||||
|
|
||||||
|
# Helper method
|
||||||
|
def _playlist_from_matches(matches, getter, ie=None):
|
||||||
|
urlrs = orderedSet(self.url_result(getter(m), ie) for m in matches)
|
||||||
|
return self.playlist_result(
|
||||||
|
urlrs, playlist_id=video_id, playlist_title=video_title)
|
||||||
|
|
||||||
# Look for BrightCove:
|
# Look for BrightCove:
|
||||||
bc_urls = BrightcoveIE._extract_brightcove_urls(webpage)
|
bc_urls = BrightcoveIE._extract_brightcove_urls(webpage)
|
||||||
if bc_urls:
|
if bc_urls:
|
||||||
|
@ -537,35 +546,15 @@ class GenericIE(InfoExtractor):
|
||||||
(?:embed|v)/.+?)
|
(?:embed|v)/.+?)
|
||||||
\1''', webpage)
|
\1''', webpage)
|
||||||
if matches:
|
if matches:
|
||||||
urlrs = [self.url_result(unescapeHTML(tuppl[1]), 'Youtube')
|
return _playlist_from_matches(
|
||||||
for tuppl in matches]
|
matches, lambda m: unescapeHTML(m[1]), ie='Youtube')
|
||||||
# First, ensure we have a duplicate free list of entries
|
|
||||||
seen = set()
|
|
||||||
new_list = []
|
|
||||||
theurl = tuple(url.items())
|
|
||||||
if theurl not in seen:
|
|
||||||
seen.add(theurl)
|
|
||||||
new_list.append(url)
|
|
||||||
urlrs = new_list
|
|
||||||
return self.playlist_result(
|
|
||||||
urlrs, playlist_id=video_id, playlist_title=video_title)
|
|
||||||
|
|
||||||
# Look for embedded Dailymotion player
|
# Look for embedded Dailymotion player
|
||||||
matches = re.findall(
|
matches = re.findall(
|
||||||
r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.com/embed/video/.+?)\1', webpage)
|
r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.com/embed/video/.+?)\1', webpage)
|
||||||
if matches:
|
if matches:
|
||||||
urlrs = [self.url_result(unescapeHTML(tuppl[1]))
|
return _playlist_from_matches(
|
||||||
for tuppl in matches]
|
matches, lambda m: unescapeHTML(m[1]))
|
||||||
# First, ensure we have a duplicate free list of entries
|
|
||||||
seen = set()
|
|
||||||
new_list = []
|
|
||||||
theurl = tuple(url.items())
|
|
||||||
if theurl not in seen:
|
|
||||||
seen.add(theurl)
|
|
||||||
new_list.append(url)
|
|
||||||
urlrs = new_list
|
|
||||||
return self.playlist_result(
|
|
||||||
urlrs, playlist_id=video_id, playlist_title=video_title)
|
|
||||||
|
|
||||||
# Look for embedded Wistia player
|
# Look for embedded Wistia player
|
||||||
match = re.search(
|
match = re.search(
|
||||||
|
@ -679,18 +668,8 @@ class GenericIE(InfoExtractor):
|
||||||
# Look for funnyordie embed
|
# Look for funnyordie embed
|
||||||
matches = re.findall(r'<iframe[^>]+?src="(https?://(?:www\.)?funnyordie\.com/embed/[^"]+)"', webpage)
|
matches = re.findall(r'<iframe[^>]+?src="(https?://(?:www\.)?funnyordie\.com/embed/[^"]+)"', webpage)
|
||||||
if matches:
|
if matches:
|
||||||
urlrs = [self.url_result(unescapeHTML(eurl), 'FunnyOrDie')
|
return _playlist_from_matches(
|
||||||
for eurl in matches]
|
matches, getter=unescapeHTML, ie='FunnyOrDie')
|
||||||
# First, ensure we have a duplicate free list of entries
|
|
||||||
seen = set()
|
|
||||||
new_list = []
|
|
||||||
theurl = tuple(url.items())
|
|
||||||
if theurl not in seen:
|
|
||||||
seen.add(theurl)
|
|
||||||
new_list.append(url)
|
|
||||||
urlrs = new_list
|
|
||||||
return self.playlist_result(
|
|
||||||
urlrs, playlist_id=video_id, playlist_title=video_title)
|
|
||||||
|
|
||||||
# Look for embedded RUTV player
|
# Look for embedded RUTV player
|
||||||
rutv_url = RUTVIE._extract_url(webpage)
|
rutv_url = RUTVIE._extract_url(webpage)
|
||||||
|
|
Loading…
Reference in New Issue