mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-11-18 10:05:58 +01:00
[rutube] Add support for user videos
This commit is contained in:
parent
87fac3238d
commit
e3a9f32f52
2 changed files with 17 additions and 8 deletions
|
@ -164,7 +164,8 @@ from .rtlnow import RTLnowIE
|
||||||
from .rutube import (
|
from .rutube import (
|
||||||
RutubeIE,
|
RutubeIE,
|
||||||
RutubeChannelIE,
|
RutubeChannelIE,
|
||||||
RutubeMovieIE
|
RutubeMovieIE,
|
||||||
|
RutubePersonIE,
|
||||||
)
|
)
|
||||||
from .servingsys import ServingSysIE
|
from .servingsys import ServingSysIE
|
||||||
from .sina import SinaIE
|
from .sina import SinaIE
|
||||||
|
|
|
@ -16,7 +16,7 @@ from ..utils import (
|
||||||
class RutubeIE(InfoExtractor):
|
class RutubeIE(InfoExtractor):
|
||||||
IE_NAME = 'rutube'
|
IE_NAME = 'rutube'
|
||||||
IE_DESC = 'Rutube videos'
|
IE_DESC = 'Rutube videos'
|
||||||
_VALID_URL = r'https?://rutube\.ru/video/(?P<long_id>\w+)'
|
_VALID_URL = r'https?://rutube\.ru/video/(?P<id>[\da-z]{32})'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://rutube.ru/video/3eac3b4561676c17df9132a9a1e62e3e/',
|
'url': 'http://rutube.ru/video/3eac3b4561676c17df9132a9a1e62e3e/',
|
||||||
|
@ -34,14 +34,14 @@ class RutubeIE(InfoExtractor):
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
long_id = mobj.group('long_id')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
api_response = self._download_webpage('http://rutube.ru/api/video/%s/?format=json' % long_id,
|
api_response = self._download_webpage('http://rutube.ru/api/video/%s/?format=json' % video_id,
|
||||||
long_id, 'Downloading video JSON')
|
video_id, 'Downloading video JSON')
|
||||||
video = json.loads(api_response)
|
video = json.loads(api_response)
|
||||||
|
|
||||||
api_response = self._download_webpage('http://rutube.ru/api/play/trackinfo/%s/?format=json' % long_id,
|
api_response = self._download_webpage('http://rutube.ru/api/play/trackinfo/%s/?format=json' % video_id,
|
||||||
long_id, 'Downloading trackinfo JSON')
|
video_id, 'Downloading trackinfo JSON')
|
||||||
trackinfo = json.loads(api_response)
|
trackinfo = json.loads(api_response)
|
||||||
|
|
||||||
# Some videos don't have the author field
|
# Some videos don't have the author field
|
||||||
|
@ -108,4 +108,12 @@ class RutubeMovieIE(RutubeChannelIE):
|
||||||
'Downloading movie JSON')
|
'Downloading movie JSON')
|
||||||
movie = json.loads(api_response)
|
movie = json.loads(api_response)
|
||||||
movie_name = movie['name']
|
movie_name = movie['name']
|
||||||
return self._extract_videos(movie_id, movie_name)
|
return self._extract_videos(movie_id, movie_name)
|
||||||
|
|
||||||
|
|
||||||
|
class RutubePersonIE(RutubeChannelIE):
|
||||||
|
IE_NAME = 'rutube:person'
|
||||||
|
IE_DESC = 'Rutube person videos'
|
||||||
|
_VALID_URL = r'http://rutube\.ru/video/person/(?P<id>\d+)'
|
||||||
|
|
||||||
|
_PAGE_TEMPLATE = 'http://rutube.ru/api/video/person/%s/?page=%s&format=json'
|
Loading…
Reference in a new issue