mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-01 03:56:21 +02:00
[ultimedia] Handle youtube embeds
This commit is contained in:
parent
73900846b1
commit
b30ef07c6c
@ -1,6 +1,8 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
@ -60,12 +62,18 @@ def _real_extract(self, url):
|
|||||||
video_id)
|
video_id)
|
||||||
|
|
||||||
quality = qualities(['flash', 'html5'])
|
quality = qualities(['flash', 'html5'])
|
||||||
|
formats = []
|
||||||
formats = [{
|
for mode in player['modes']:
|
||||||
'url': mode['config']['file'],
|
video_url = mode.get('config', {}).get('file')
|
||||||
'format_id': mode.get('type'),
|
if not video_url:
|
||||||
'quality': quality(mode.get('type')),
|
continue
|
||||||
} for mode in player['modes']]
|
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)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
thumbnail = player.get('image')
|
thumbnail = player.get('image')
|
||||||
|
Loading…
Reference in New Issue
Block a user