[imdb] Extract all formats (closes #16249)
This commit is contained in:
parent
ae1c585cee
commit
7dd6ab4a47
1 changed files with 21 additions and 13 deletions
|
@ -3,7 +3,9 @@ from __future__ import unicode_literals
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_str
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
determine_ext,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
qualities,
|
qualities,
|
||||||
remove_end,
|
remove_end,
|
||||||
|
@ -73,19 +75,25 @@ class ImdbIE(InfoExtractor):
|
||||||
video_info_list = format_info.get('videoInfoList')
|
video_info_list = format_info.get('videoInfoList')
|
||||||
if not video_info_list or not isinstance(video_info_list, list):
|
if not video_info_list or not isinstance(video_info_list, list):
|
||||||
continue
|
continue
|
||||||
video_info = video_info_list[0]
|
for video_info in video_info_list:
|
||||||
if not video_info or not isinstance(video_info, dict):
|
if not video_info or not isinstance(video_info, dict):
|
||||||
continue
|
continue
|
||||||
video_url = video_info.get('videoUrl')
|
video_url = video_info.get('videoUrl')
|
||||||
if not video_url:
|
if not video_url or not isinstance(video_url, compat_str):
|
||||||
continue
|
continue
|
||||||
format_id = format_info.get('ffname')
|
if (video_info.get('videoMimeType') == 'application/x-mpegURL' or
|
||||||
formats.append({
|
determine_ext(video_url) == 'm3u8'):
|
||||||
'format_id': format_id,
|
formats.extend(self._extract_m3u8_formats(
|
||||||
'url': video_url,
|
video_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
||||||
'ext': mimetype2ext(video_info.get('videoMimeType')),
|
m3u8_id='hls', fatal=False))
|
||||||
'quality': quality(format_id),
|
continue
|
||||||
})
|
format_id = format_info.get('ffname')
|
||||||
|
formats.append({
|
||||||
|
'format_id': format_id,
|
||||||
|
'url': video_url,
|
||||||
|
'ext': mimetype2ext(video_info.get('videoMimeType')),
|
||||||
|
'quality': quality(format_id),
|
||||||
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue