aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/ultimedia.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-03-19 01:06:39 +0600
committerSergey M․ <dstftw@gmail.com>2015-03-19 01:06:39 +0600
commitb30ef07c6ccb982cff623c34e7c5cec5d8eb9bb9 (patch)
treea6fd172837219098f2b86e95f4cd4af218f0c186 /youtube_dl/extractor/ultimedia.py
parent73900846b16d33f769d35ac945a97a66cc17fd5c (diff)
[ultimedia] Handle youtube embeds
Diffstat (limited to 'youtube_dl/extractor/ultimedia.py')
-rw-r--r--youtube_dl/extractor/ultimedia.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/youtube_dl/extractor/ultimedia.py b/youtube_dl/extractor/ultimedia.py
index 0c1b08d7d..06554a1be 100644
--- a/youtube_dl/extractor/ultimedia.py
+++ b/youtube_dl/extractor/ultimedia.py
@@ -1,6 +1,8 @@
# coding: utf-8
from __future__ import unicode_literals
+import re
+
from .common import InfoExtractor
from ..utils import (
ExtractorError,
@@ -60,12 +62,18 @@ class UltimediaIE(InfoExtractor):
video_id)
quality = qualities(['flash', 'html5'])
-
- formats = [{
- 'url': mode['config']['file'],
- 'format_id': mode.get('type'),
- 'quality': quality(mode.get('type')),
- } for mode in player['modes']]
+ formats = []
+ for mode in player['modes']:
+ video_url = mode.get('config', {}).get('file')
+ if not video_url:
+ continue
+ if re.match(r'https?://www\.youtube\.com/.+?', video_url):
+ return self.url_result(video_url, 'Youtube')
+ formats.append({
+ 'url': video_url,
+ 'format_id': mode.get('type'),
+ 'quality': quality(mode.get('type')),
+ })
self._sort_formats(formats)
thumbnail = player.get('image')