[Pladform] Fix redirection to external player (#2550)

Authored by: KiberInfinity
pull/2572/head
KiberInfinity 3 years ago committed by GitHub
parent 403be2eefb
commit f7d4854131
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,6 +28,24 @@ class PladformIE(InfoExtractor):
(?P<id>\d+) (?P<id>\d+)
''' '''
_TESTS = [{ _TESTS = [{
'url': 'http://out.pladform.ru/player?pl=18079&type=html5&videoid=100231282',
'info_dict': {
'id': '6216d548e755edae6e8280667d774791',
'ext': 'mp4',
'timestamp': 1406117012,
'title': 'Гарик Мартиросян и Гарик Харламов - Кастинг на концерт ко Дню милиции',
'age_limit': 0,
'upload_date': '20140723',
'thumbnail': str,
'view_count': int,
'description': str,
'category': list,
'uploader_id': '12082',
'uploader': 'Comedy Club',
'duration': 367,
},
'expected_warnings': ['HTTP Error 404: Not Found']
}, {
'url': 'https://out.pladform.ru/player?pl=64471&videoid=3777899&vk_puid15=0&vk_puid34=0', 'url': 'https://out.pladform.ru/player?pl=64471&videoid=3777899&vk_puid15=0&vk_puid34=0',
'md5': '53362fac3a27352da20fa2803cc5cd6f', 'md5': '53362fac3a27352da20fa2803cc5cd6f',
'info_dict': { 'info_dict': {
@ -63,13 +81,19 @@ class PladformIE(InfoExtractor):
'http://out.pladform.ru/getVideo', video_id, query={ 'http://out.pladform.ru/getVideo', video_id, query={
'pl': pl, 'pl': pl,
'videoid': video_id, 'videoid': video_id,
}) }, fatal=False)
def fail(text): def fail(text):
raise ExtractorError( raise ExtractorError(
'%s returned error: %s' % (self.IE_NAME, text), '%s returned error: %s' % (self.IE_NAME, text),
expected=True) expected=True)
if not video:
targetUrl = self._request_webpage(url, video_id, note='Resolving final URL').geturl()
if targetUrl == url:
raise ExtractorError('Can\'t parse page')
return self.url_result(targetUrl)
if video.tag == 'error': if video.tag == 'error':
fail(video.text) fail(video.text)

Loading…
Cancel
Save