aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/generic.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-09-06 00:48:37 +0700
committerSergey M․ <dstftw@gmail.com>2017-09-06 00:48:37 +0700
commit66c9fa36c10860b380806b9de48f38d628289e03 (patch)
tree7d9b1991b5ae9082c3d0ea8e683c7cc7af627442 /youtube_dl/extractor/generic.py
parentc5c9bf0c120d2c481124a0c3913b981cf061fb95 (diff)
downloadyoutube-dl-66c9fa36c10860b380806b9de48f38d628289e03.zip
youtube-dl-66c9fa36c10860b380806b9de48f38d628289e03.tar.gz
youtube-dl-66c9fa36c10860b380806b9de48f38d628289e03.tar.bz2
[youtube] Separate methods for embeds extraction
Diffstat (limited to 'youtube_dl/extractor/generic.py')
-rw-r--r--youtube_dl/extractor/generic.py33
1 files changed, 4 insertions, 29 deletions
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index c81efdc..b83c183 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -2243,36 +2243,11 @@ class GenericIE(InfoExtractor):
if vid_me_embed_url is not None:
return self.url_result(vid_me_embed_url, 'Vidme')
- # Look for embedded YouTube player
- matches = re.findall(r'''(?x)
- (?:
- <iframe[^>]+?src=|
- data-video-url=|
- <embed[^>]+?src=|
- embedSWF\(?:\s*|
- <object[^>]+data=|
- new\s+SWFObject\(
- )
- (["\'])
- (?P<url>(?:https?:)?//(?:www\.)?youtube(?:-nocookie)?\.com/
- (?:embed|v|p)/.+?)
- \1''', webpage)
- if matches:
+ # Look for YouTube embeds
+ youtube_urls = YoutubeIE._extract_urls(webpage)
+ if youtube_urls:
return self.playlist_from_matches(
- matches, video_id, video_title, lambda m: unescapeHTML(m[1]))
-
- # Look for lazyYT YouTube embed
- matches = re.findall(
- r'class="lazyYT" data-youtube-id="([^"]+)"', webpage)
- if matches:
- return self.playlist_from_matches(matches, video_id, video_title, lambda m: unescapeHTML(m))
-
- # Look for Wordpress "YouTube Video Importer" plugin
- matches = re.findall(r'''(?x)<div[^>]+
- class=(?P<q1>[\'"])[^\'"]*\byvii_single_video_player\b[^\'"]*(?P=q1)[^>]+
- data-video_id=(?P<q2>[\'"])([^\'"]+)(?P=q2)''', webpage)
- if matches:
- return self.playlist_from_matches(matches, video_id, video_title, lambda m: m[-1])
+ youtube_urls, video_id, video_title, ie=YoutubeIE.ie_key())
matches = DailymotionIE._extract_urls(webpage)
if matches: