-import re
-
from .common import InfoExtractor
from ..utils import (
- determine_ext,
ExtractorError,
+ determine_ext,
int_or_none,
parse_qs,
- xpath_text,
qualities,
+ xpath_text,
)
)
(?P<id>\d+)
'''
+ _EMBED_REGEX = [r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//out\.pladform\.ru/player\?.+?)\1']
_TESTS = [{
'url': 'http://out.pladform.ru/player?pl=18079&type=html5&videoid=100231282',
'info_dict': {
'thumbnail': str,
'view_count': int,
'description': str,
- 'category': list,
'uploader_id': '12082',
'uploader': 'Comedy Club',
'duration': 367,
},
- 'expected_warnings': ['HTTP Error 404: Not Found']
+ 'expected_warnings': ['HTTP Error 404: Not Found'],
}, {
'url': 'https://out.pladform.ru/player?pl=64471&videoid=3777899&vk_puid15=0&vk_puid34=0',
'md5': '53362fac3a27352da20fa2803cc5cd6f',
'only_matching': True,
}]
- @staticmethod
- def _extract_url(webpage):
- mobj = re.search(
- r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//out\.pladform\.ru/player\?.+?)\1', webpage)
- if mobj:
- return mobj.group('url')
-
def _real_extract(self, url):
video_id = self._match_id(url)
def fail(text):
raise ExtractorError(
- '%s returned error: %s' % (self.IE_NAME, text),
+ f'{self.IE_NAME} returned error: {text}',
expected=True)
if not video:
- targetUrl = self._request_webpage(url, video_id, note='Resolving final URL').geturl()
- if targetUrl == url:
+ target_url = self._request_webpage(url, video_id, note='Resolving final URL').url
+ if target_url == url:
raise ExtractorError('Can\'t parse page')
- return self.url_result(targetUrl)
+ return self.url_result(target_url)
if video.tag == 'error':
fail(video.text)
if error:
fail(error)
- self._sort_formats(formats)
-
webpage = self._download_webpage(
- 'http://video.pladform.ru/catalog/video/videoid/%s' % video_id,
+ f'http://video.pladform.ru/catalog/video/videoid/{video_id}',
video_id)
title = self._og_search_title(webpage, fatal=False) or xpath_text(