[mitele] Fix extraction (closes #15186)
This commit is contained in:
parent
45283afdec
commit
f12628f934
|
@ -1,13 +1,13 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from .ooyala import OoyalaIE
|
from .ooyala import OoyalaIE
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_str,
|
compat_str,
|
||||||
compat_urllib_parse_urlencode,
|
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
@ -42,31 +42,33 @@ class MiTeleBaseIE(InfoExtractor):
|
||||||
duration = int_or_none(mmc.get('duration'))
|
duration = int_or_none(mmc.get('duration'))
|
||||||
for location in mmc['locations']:
|
for location in mmc['locations']:
|
||||||
gat = self._proto_relative_url(location.get('gat'), 'http:')
|
gat = self._proto_relative_url(location.get('gat'), 'http:')
|
||||||
bas = location.get('bas')
|
gcp = location.get('gcp')
|
||||||
loc = location.get('loc')
|
|
||||||
ogn = location.get('ogn')
|
ogn = location.get('ogn')
|
||||||
if None in (gat, bas, loc, ogn):
|
if None in (gat, gcp, ogn):
|
||||||
continue
|
continue
|
||||||
token_data = {
|
token_data = {
|
||||||
'bas': bas,
|
'gcp': gcp,
|
||||||
'icd': loc,
|
|
||||||
'ogn': ogn,
|
'ogn': ogn,
|
||||||
'sta': '0',
|
'sta': 0,
|
||||||
}
|
}
|
||||||
media = self._download_json(
|
media = self._download_json(
|
||||||
'%s/?%s' % (gat, compat_urllib_parse_urlencode(token_data)),
|
gat, video_id, data=json.dumps(token_data).encode('utf-8'),
|
||||||
video_id, 'Downloading %s JSON' % location['loc'])
|
headers={
|
||||||
file_ = media.get('file')
|
'Content-Type': 'application/json;charset=utf-8',
|
||||||
if not file_:
|
'Referer': url,
|
||||||
|
})
|
||||||
|
stream = media.get('stream') or media.get('file')
|
||||||
|
if not stream:
|
||||||
continue
|
continue
|
||||||
ext = determine_ext(file_)
|
ext = determine_ext(stream)
|
||||||
if ext == 'f4m':
|
if ext == 'f4m':
|
||||||
formats.extend(self._extract_f4m_formats(
|
formats.extend(self._extract_f4m_formats(
|
||||||
file_ + '&hdcore=3.2.0&plugin=aasp-3.2.0.77.18',
|
stream + '&hdcore=3.2.0&plugin=aasp-3.2.0.77.18',
|
||||||
video_id, f4m_id='hds', fatal=False))
|
video_id, f4m_id='hds', fatal=False))
|
||||||
elif ext == 'm3u8':
|
elif ext == 'm3u8':
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
file_, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
|
stream, video_id, 'mp4', 'm3u8_native',
|
||||||
|
m3u8_id='hls', fatal=False))
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue