[funnyordie] Improve extraction

This commit is contained in:
Andy Savicki 2016-11-16 02:37:28 +03:00 committed by Sergey M․
parent 2574721a81
commit 4eece8ba57
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D
1 changed files with 7 additions and 5 deletions

View File

@ -11,7 +11,7 @@ class FunnyOrDieIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?funnyordie\.com/(?P<type>embed|articles|videos)/(?P<id>[0-9a-f]+)(?:$|[?#/])' _VALID_URL = r'https?://(?:www\.)?funnyordie\.com/(?P<type>embed|articles|videos)/(?P<id>[0-9a-f]+)(?:$|[?#/])'
_TESTS = [{ _TESTS = [{
'url': 'http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version', 'url': 'http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version',
'md5': 'bcd81e0c4f26189ee09be362ad6e6ba9', 'md5': 'c26b9ee0e1ca138c12071f59572ba9c7',
'info_dict': { 'info_dict': {
'id': '0732f586d7', 'id': '0732f586d7',
'ext': 'mp4', 'ext': 'mp4',
@ -51,10 +51,7 @@ class FunnyOrDieIE(InfoExtractor):
formats = [] formats = []
formats.extend(self._extract_m3u8_formats( bitrates = [int(bitrate) for bitrate in re.findall(r'[,/]v(\d+)(?=[,/])', m3u8_url)]
m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
bitrates = [int(bitrate) for bitrate in re.findall(r'[,/]v(\d+)[,/]', m3u8_url)]
bitrates.sort() bitrates.sort()
for bitrate in bitrates: for bitrate in bitrates:
@ -65,6 +62,11 @@ class FunnyOrDieIE(InfoExtractor):
'vbr': bitrate, 'vbr': bitrate,
}) })
self._check_formats(formats, video_id)
formats.extend(self._extract_m3u8_formats(
m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
subtitles = {} subtitles = {}
for src, src_lang in re.findall(r'<track kind="captions" src="([^"]+)" srclang="([^"]+)"', webpage): for src, src_lang in re.findall(r'<track kind="captions" src="([^"]+)" srclang="([^"]+)"', webpage):
subtitles[src_lang] = [{ subtitles[src_lang] = [{