1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-21 00:12:51 +08:00

Improve some regexes for embedded players

This commit is contained in:
dst 2014-01-30 04:26:46 +07:00
parent 0c708f11cb
commit c3f51436bf

View File

@ -254,7 +254,7 @@ class GenericIE(InfoExtractor):
# Look for embedded (iframe) Vimeo player # Look for embedded (iframe) Vimeo player
mobj = re.search( mobj = re.search(
r'<iframe[^>]+?src="((?:https?:)?//player.vimeo.com/video/.+?)"', webpage) r'<iframe[^>]+?src="((?:https?:)?//player\.vimeo\.com/video/.+?)"', webpage)
if mobj: if mobj:
player_url = unescapeHTML(mobj.group(1)) player_url = unescapeHTML(mobj.group(1))
surl = smuggle_url(player_url, {'Referer': url}) surl = smuggle_url(player_url, {'Referer': url})
@ -262,7 +262,7 @@ class GenericIE(InfoExtractor):
# Look for embedded (swf embed) Vimeo player # Look for embedded (swf embed) Vimeo player
mobj = re.search( mobj = re.search(
r'<embed[^>]+?src="(https?://(?:www\.)?vimeo.com/moogaloop.swf.+?)"', webpage) r'<embed[^>]+?src="(https?://(?:www\.)?vimeo\.com/moogaloop\.swf.+?)"', webpage)
if mobj: if mobj:
return self.url_result(mobj.group(1), 'Vimeo') return self.url_result(mobj.group(1), 'Vimeo')
@ -332,7 +332,7 @@ class GenericIE(InfoExtractor):
return self.url_result(mobj.group(1), 'Aparat') return self.url_result(mobj.group(1), 'Aparat')
# Look for MPORA videos # Look for MPORA videos
mobj = re.search(r'<iframe .*?src="(http://mpora\.com/videos/[^"]+)"', webpage) mobj = re.search(r'<iframe .*?src="(http://mpora\.(?:com|de)/videos/[^"]+)"', webpage)
if mobj is not None: if mobj is not None:
return self.url_result(mobj.group(1), 'Mpora') return self.url_result(mobj.group(1), 'Mpora')
@ -350,7 +350,7 @@ class GenericIE(InfoExtractor):
# Look for embedded Huffington Post player # Look for embedded Huffington Post player
mobj = re.search( mobj = re.search(
r'<iframe[^>]+?src=(["\'])(?P<url>https?://embed\.live.huffingtonpost\.com/.+?)\1', webpage) r'<iframe[^>]+?src=(["\'])(?P<url>https?://embed\.live\.huffingtonpost\.com/.+?)\1', webpage)
if mobj is not None: if mobj is not None:
return self.url_result(mobj.group('url'), 'HuffPost') return self.url_result(mobj.group('url'), 'HuffPost')