mirror of https://github.com/blackjack4494/yt-dlc
[vk] Add support for rutube embeds (Fixes #4514)
This commit is contained in:
parent
2ccd1b10e5
commit
7a1818c99b
|
@ -359,6 +359,7 @@ from .ruhd import RUHDIE
|
||||||
from .rutube import (
|
from .rutube import (
|
||||||
RutubeIE,
|
RutubeIE,
|
||||||
RutubeChannelIE,
|
RutubeChannelIE,
|
||||||
|
RutubeEmbedIE,
|
||||||
RutubeMovieIE,
|
RutubeMovieIE,
|
||||||
RutubePersonIE,
|
RutubePersonIE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -70,6 +70,37 @@ class RutubeIE(InfoExtractor):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class RutubeEmbedIE(InfoExtractor):
|
||||||
|
IE_NAME = 'rutube:embed'
|
||||||
|
IE_DESC = 'Rutube embedded videos'
|
||||||
|
_VALID_URL = 'https?://rutube\.ru/video/embed/(?P<id>[0-9]+)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://rutube.ru/video/embed/6722881?vk_puid37=&vk_puid38=',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'a10e53b86e8f349080f718582ce4c661',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'upload_date': '20131223',
|
||||||
|
'uploader_id': '297833',
|
||||||
|
'description': 'Видео группы ★http://vk.com/foxkidsreset★ музей Fox Kids и Jetix<br/><br/> восстановлено и сделано в шикоформате subziro89 http://vk.com/subziro89',
|
||||||
|
'uploader': 'subziro89 ILya',
|
||||||
|
'title': 'Мистический городок Эйри в Индиан 5 серия озвучка subziro89',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': 'Requires ffmpeg',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
embed_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, embed_id)
|
||||||
|
|
||||||
|
canonical_url = self._html_search_regex(
|
||||||
|
r'<link\s+rel="canonical"\s+href="([^"]+?)"', webpage,
|
||||||
|
'Canonical URL')
|
||||||
|
return self.url_result(canonical_url, 'Rutube')
|
||||||
|
|
||||||
|
|
||||||
class RutubeChannelIE(InfoExtractor):
|
class RutubeChannelIE(InfoExtractor):
|
||||||
IE_NAME = 'rutube:channel'
|
IE_NAME = 'rutube:channel'
|
||||||
IE_DESC = 'Rutube channels'
|
IE_DESC = 'Rutube channels'
|
||||||
|
|
|
@ -164,6 +164,15 @@ class VKIE(InfoExtractor):
|
||||||
self.to_screen('Youtube video detected')
|
self.to_screen('Youtube video detected')
|
||||||
return self.url_result(m_yt.group(1), 'Youtube')
|
return self.url_result(m_yt.group(1), 'Youtube')
|
||||||
|
|
||||||
|
m_rutube = re.search(
|
||||||
|
r'\ssrc="((?:https?:)?//rutube\.ru\\?/video\\?/embed(?:.*?))\\?"', info_page)
|
||||||
|
assert m_rutube
|
||||||
|
if m_rutube is not None:
|
||||||
|
self.to_screen('rutube video detected')
|
||||||
|
rutube_url = self._proto_relative_url(
|
||||||
|
m_rutube.group(1).replace('\\', ''))
|
||||||
|
return self.url_result(rutube_url)
|
||||||
|
|
||||||
m_opts = re.search(r'(?s)var\s+opts\s*=\s*({.*?});', info_page)
|
m_opts = re.search(r'(?s)var\s+opts\s*=\s*({.*?});', info_page)
|
||||||
if m_opts:
|
if m_opts:
|
||||||
m_opts_url = re.search(r"url\s*:\s*'([^']+)", m_opts.group(1))
|
m_opts_url = re.search(r"url\s*:\s*'([^']+)", m_opts.group(1))
|
||||||
|
|
Loading…
Reference in New Issue