[nova] Fix extension extraction bug

Replace the hardcoded flv with determine_ext. Let rtmpdump parse the url.
This commit is contained in:
Slava Shklyaev 2015-06-02 12:52:39 +03:00
parent 9f4b9118cc
commit 9464a194db

View File

@ -4,6 +4,7 @@
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import determine_ext
class NovaIE(InfoExtractor): class NovaIE(InfoExtractor):
@ -39,7 +40,7 @@ class NovaIE(InfoExtractor):
'info_dict': { 'info_dict': {
'id': '1756825', 'id': '1756825',
'display_id': '5591-policie-modrava-15-dil-blondynka-na-hrbitove', 'display_id': '5591-policie-modrava-15-dil-blondynka-na-hrbitove',
'ext': 'flv', 'ext': 'mp4',
'title': 'Policie Modrava - 15. díl - Blondýnka na hřbitově', 'title': 'Policie Modrava - 15. díl - Blondýnka na hřbitově',
'description': 'md5:d804ba6b30bc7da2705b1fea961bddfe', 'description': 'md5:d804ba6b30bc7da2705b1fea961bddfe',
'thumbnail': 're:^https?://.*\.(?:jpg)', 'thumbnail': 're:^https?://.*\.(?:jpg)',
@ -108,21 +109,8 @@ def _real_extract(self, url):
mediafile = config['mediafile'] mediafile = config['mediafile']
video_url = mediafile['src'] video_url = mediafile['src']
ext = determine_ext(video_url)
m = re.search(r'^(?P<url>rtmpe?://[^/]+/(?P<app>[^/]+?))/&*(?P<playpath>.+)$', video_url) video_url = video_url.replace('&{}:'.format(ext), '')
if m:
formats = [{
'url': m.group('url'),
'app': m.group('app'),
'play_path': m.group('playpath'),
'player_path': 'http://tvnoviny.nova.cz/static/shared/app/videojs/video-js.swf',
'ext': 'flv',
}]
else:
formats = [{
'url': video_url,
}]
self._sort_formats(formats)
title = mediafile.get('meta', {}).get('title') or self._og_search_title(webpage) title = mediafile.get('meta', {}).get('title') or self._og_search_title(webpage)
description = self._og_search_description(webpage) description = self._og_search_description(webpage)
@ -134,5 +122,6 @@ def _real_extract(self, url):
'title': title, 'title': title,
'description': description, 'description': description,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'formats': formats, 'url': video_url,
'ext': ext,
} }