import itertools
from .common import InfoExtractor
-from ..compat import (
- compat_str,
-)
from ..utils import (
- determine_ext,
bool_or_none,
+ determine_ext,
int_or_none,
parse_qs,
try_get,
query = {}
query['format'] = 'json'
return self._download_json(
- 'http://rutube.ru/api/video/%s/' % video_id,
+ f'http://rutube.ru/api/video/{video_id}/',
video_id, 'Downloading video JSON',
'Unable to download video JSON', query=query)
'thumbnail': video.get('thumbnail_url'),
'duration': duration,
'uploader': try_get(video, lambda x: x['author']['name']),
- 'uploader_id': compat_str(uploader_id) if uploader_id else None,
+ 'uploader_id': str(uploader_id) if uploader_id else None,
'timestamp': unified_timestamp(video.get('created_ts')),
- 'category': [category] if category else None,
+ 'categories': [category] if category else None,
'age_limit': age_limit,
'view_count': int_or_none(video.get('hits')),
'comment_count': int_or_none(video.get('comments_count')),
query = {}
query['format'] = 'json'
return self._download_json(
- 'http://rutube.ru/api/play/options/%s/' % video_id,
+ f'http://rutube.ru/api/play/options/{video_id}/',
video_id, 'Downloading options JSON',
'Unable to download options JSON',
headers=self.geo_verification_headers(), query=query)
'age_limit': 0,
'view_count': int,
'thumbnail': 'http://pic.rutubelist.ru/video/d2/a0/d2a0aec998494a396deafc7ba2c82add.jpg',
- 'category': ['Новости и СМИ'],
+ 'categories': ['Новости и СМИ'],
'chapters': [],
},
'expected_warnings': ['Unable to download f4m'],
'age_limit': 0,
'view_count': int,
'thumbnail': 'http://pic.rutubelist.ru/video/f2/d4/f2d42b54be0a6e69c1c22539e3152156.jpg',
- 'category': ['Видеоигры'],
+ 'categories': ['Видеоигры'],
'chapters': [],
},
'expected_warnings': ['Unable to download f4m'],
'id': 'c65b465ad0c98c89f3b25cb03dcc87c6',
'ext': 'mp4',
'chapters': 'count:4',
- 'category': ['Бизнес и предпринимательство'],
+ 'categories': ['Бизнес и предпринимательство'],
'description': 'md5:252feac1305257d8c1bab215cedde75d',
'thumbnail': 'http://pic.rutubelist.ru/video/71/8f/718f27425ea9706073eb80883dd3787b.png',
'duration': 782,
@classmethod
def suitable(cls, url):
- return False if RutubePlaylistIE.suitable(url) else super(RutubeIE, cls).suitable(url)
+ return False if RutubePlaylistIE.suitable(url) else super().suitable(url)
def _real_extract(self, url):
video_id = self._match_id(url)
page = self._download_json(
next_page_url or self._next_page_url(
pagenum, playlist_id, *args, **kwargs),
- playlist_id, 'Downloading page %s' % pagenum)
+ playlist_id, f'Downloading page {pagenum}')
results = page.get('results')
if not results or not isinstance(results, list):
def suitable(cls, url):
from ..utils import int_or_none, parse_qs
- if not super(RutubePlaylistIE, cls).suitable(url):
+ if not super().suitable(url):
return False
params = parse_qs(url)
return params.get('pl_type', [None])[0] and int_or_none(params.get('pl_id', [None])[0])