[rte:radio] Simplify

This commit is contained in:
Sergey M․ 2016-01-04 05:01:32 +06:00
parent 0238451fc0
commit 9746f4314a

View File

@ -2,7 +2,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
float_or_none, float_or_none,
unescapeHTML, unescapeHTML,
@ -98,19 +97,19 @@ def _real_extract(self, url):
formats = [] formats = []
if mg.get('url') and not mg['url'].startswith('rtmpe:'): if mg.get('url') and not mg['url'].startswith('rtmpe:'):
formats.append({'url': mg.get('url')}) formats.append({'url': mg['url']})
if mg.get('hls_server') and mg.get('hls_url'): if mg.get('hls_server') and mg.get('hls_url'):
hls_url = mg['hls_server'] + mg['hls_url'] formats.extend(self._extract_m3u8_formats(
hls_formats = self._extract_m3u8_formats( mg['hls_server'] + mg['hls_url'], item_id, 'mp4',
hls_url, item_id, 'mp4', m3u8_id='hls', fatal=False) entry_protocol='m3u8_native', m3u8_id='hls', fatal=False))
formats.extend(hls_formats)
if mg.get('hds_server') and mg.get('hds_url'): if mg.get('hds_server') and mg.get('hds_url'):
f4m_url = mg['hds_server'] + mg['hds_url'] formats.extend(self._extract_f4m_formats(
f4m_formats = self._extract_f4m_formats( mg['hds_server'] + mg['hds_url'], item_id,
f4m_url, item_id, f4m_id='hds', fatal=False) f4m_id='hds', fatal=False))
formats.extend(f4m_formats)
self._sort_formats(formats)
return { return {
'id': item_id, 'id': item_id,