]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Simplify formats accumulation for f4m/m3u8/smil formats
authorSergey M․ <dstftw@gmail.com>
Mon, 28 Dec 2015 18:58:24 +0000 (00:58 +0600)
committerSergey M․ <dstftw@gmail.com>
Mon, 28 Dec 2015 18:58:24 +0000 (00:58 +0600)
Now all _extract_*_formats routines return a list

32 files changed:
youtube_dl/extractor/amp.py
youtube_dl/extractor/ard.py
youtube_dl/extractor/atresplayer.py
youtube_dl/extractor/audimedia.py
youtube_dl/extractor/bbc.py
youtube_dl/extractor/bloomberg.py
youtube_dl/extractor/br.py
youtube_dl/extractor/brightcove.py
youtube_dl/extractor/common.py
youtube_dl/extractor/dailymotion.py
youtube_dl/extractor/dcn.py
youtube_dl/extractor/eitb.py
youtube_dl/extractor/funimation.py
youtube_dl/extractor/funnyordie.py
youtube_dl/extractor/globo.py
youtube_dl/extractor/hotstar.py
youtube_dl/extractor/ign.py
youtube_dl/extractor/jwplatform.py
youtube_dl/extractor/kaltura.py
youtube_dl/extractor/livestream.py
youtube_dl/extractor/nba.py
youtube_dl/extractor/ooyala.py
youtube_dl/extractor/rai.py
youtube_dl/extractor/rutube.py
youtube_dl/extractor/ruutu.py
youtube_dl/extractor/tele13.py
youtube_dl/extractor/toggle.py
youtube_dl/extractor/vgtv.py
youtube_dl/extractor/viki.py
youtube_dl/extractor/vimeo.py
youtube_dl/extractor/wdr.py
youtube_dl/extractor/zdf.py

index dcc3c97f146fc125b93a755b85a3c9c3a050b112..1035d1c4881a6f78aa5709477a8aeee4f4bda0bc 100644 (file)
@@ -53,16 +53,12 @@ class AMPIE(InfoExtractor):
             media = media_data['@attributes']
             media_type = media['type']
             if media_type == 'video/f4m':
-                f4m_formats = self._extract_f4m_formats(
+                formats.extend(self._extract_f4m_formats(
                     media['url'] + '?hdcore=3.4.0&plugin=aasp-3.4.0.132.124',
-                    video_id, f4m_id='hds', fatal=False)
-                if f4m_formats:
-                    formats.extend(f4m_formats)
+                    video_id, f4m_id='hds', fatal=False))
             elif media_type == 'application/x-mpegURL':
-                m3u8_formats = self._extract_m3u8_formats(
-                    media['url'], video_id, 'mp4', m3u8_id='hls', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                formats.extend(self._extract_m3u8_formats(
+                    media['url'], video_id, 'mp4', m3u8_id='hls', fatal=False))
             else:
                 formats.append({
                     'format_id': media_data['media-category']['@attributes']['label'],
index 687eb9f823d0a7ba34d3f3139141af96a27b8222..9fb84911a0b81fd42de2c9bd410cdaf2dd4813a6 100644 (file)
@@ -113,16 +113,12 @@ class ARDMediathekIE(InfoExtractor):
                     if quality != 'auto' and ext in ('f4m', 'm3u8'):
                         continue
                     if ext == 'f4m':
-                        f4m_formats = self._extract_f4m_formats(
+                        formats.extend(self._extract_f4m_formats(
                             stream_url + '?hdcore=3.1.1&plugin=aasp-3.1.1.69.124',
-                            video_id, preference=-1, f4m_id='hds', fatal=False)
-                        if f4m_formats:
-                            formats.extend(f4m_formats)
+                            video_id, preference=-1, f4m_id='hds', fatal=False))
                     elif ext == 'm3u8':
-                        m3u8_formats = self._extract_m3u8_formats(
-                            stream_url, video_id, 'mp4', preference=1, m3u8_id='hls', fatal=False)
-                        if m3u8_formats:
-                            formats.extend(m3u8_formats)
+                        formats.extend(self._extract_m3u8_formats(
+                            stream_url, video_id, 'mp4', preference=1, m3u8_id='hls', fatal=False))
                     else:
                         if server and server.startswith('rtmp'):
                             f = {
index 7ac3044c7013883d722945a6269add77a53ab6ec..3fb042cea4bfa68f0624cadf9e65e2d9e27c3c4a 100644 (file)
@@ -134,10 +134,8 @@ class AtresPlayerIE(InfoExtractor):
 
         m3u8_url = player.get('urlVideoHls')
         if m3u8_url:
-            m3u8_formats = self._extract_m3u8_formats(
-                m3u8_url, episode_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
-            if m3u8_formats:
-                formats.extend(m3u8_formats)
+            formats.extend(self._extract_m3u8_formats(
+                m3u8_url, episode_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
 
         timestamp = int_or_none(self._download_webpage(
             self._TIME_API_URL,
@@ -170,9 +168,7 @@ class AtresPlayerIE(InfoExtractor):
                 continue
             else:
                 f4m_url = video_url[:-9] + '/manifest.f4m'
-            f4m_formats = self._extract_f4m_formats(f4m_url, video_id, f4m_id='hds', fatal=False)
-            if f4m_formats:
-                formats.extend(f4m_formats)
+            formats.extend(self._extract_f4m_formats(f4m_url, video_id, f4m_id='hds', fatal=False))
         self._sort_formats(formats)
 
         path_data = player.get('pathData')
index 4382a302b16875e3aa854ebe9a4342cba1a8b1a9..9b037bb0c3cd53e1176b85538a38b5a9f7ab95fe 100644 (file)
@@ -45,15 +45,11 @@ class AudiMediaIE(InfoExtractor):
 
             stream_url_hls = json_data.get('stream_url_hls')
             if stream_url_hls:
-                m3u8_formats = self._extract_m3u8_formats(stream_url_hls, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                formats.extend(self._extract_m3u8_formats(stream_url_hls, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False))
 
             stream_url_hds = json_data.get('stream_url_hds')
             if stream_url_hds:
-                f4m_formats = self._extract_f4m_formats(json_data.get('stream_url_hds') + '?hdcore=3.4.0', video_id, -1, f4m_id='hds', fatal=False)
-                if f4m_formats:
-                    formats.extend(f4m_formats)
+                formats.extend(self._extract_f4m_formats(json_data.get('stream_url_hds') + '?hdcore=3.4.0', video_id, -1, f4m_id='hds', fatal=False))
 
             for video_version in json_data.get('video_versions'):
                 video_version_url = video_version.get('download_url') or video_version.get('stream_url')
index 691aecc0dbb2a9c8c49b75f6e6fc377519752eb3..923273fb2f1cc5b775f1c130235d21f683ffeb64 100644 (file)
@@ -223,11 +223,9 @@ class BBCCoUkIE(InfoExtractor):
             elif transfer_format == 'dash':
                 pass
             elif transfer_format == 'hls':
-                m3u8_formats = self._extract_m3u8_formats(
+                formats.extend(self._extract_m3u8_formats(
                     href, programme_id, ext='mp4', entry_protocol='m3u8_native',
-                    m3u8_id=supplier, fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                    m3u8_id=supplier, fatal=False))
             # Direct link
             else:
                 formats.append({
index ebeef8f2ab19e9dfcf6cdbc9c30616958344876d..13343bc258532b37bf912f0648e317103b5f428d 100644 (file)
@@ -41,15 +41,11 @@ class BloombergIE(InfoExtractor):
             if not stream_url:
                 continue
             if stream['muxing_format'] == 'TS':
-                m3u8_formats = self._extract_m3u8_formats(
-                    stream_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                formats.extend(self._extract_m3u8_formats(
+                    stream_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
             else:
-                f4m_formats = self._extract_f4m_formats(
-                    stream_url, video_id, f4m_id='hds', fatal=False)
-                if f4m_formats:
-                    formats.extend(f4m_formats)
+                formats.extend(self._extract_f4m_formats(
+                    stream_url, video_id, f4m_id='hds', fatal=False))
         self._sort_formats(formats)
 
         return {
index e6685453867382575b9dcc5c681f02c72d007867..11cf498515ba572f8ef8c7f20d5620bf50289827 100644 (file)
@@ -121,15 +121,11 @@ class BRIE(InfoExtractor):
             format_url = xpath_text(asset, ['downloadUrl', 'url'])
             asset_type = asset.get('type')
             if asset_type == 'HDS':
-                f4m_formats = self._extract_f4m_formats(
-                    format_url + '?hdcore=3.2.0', media_id, f4m_id='hds', fatal=False)
-                if f4m_formats:
-                    formats.extend(f4m_formats)
+                formats.extend(self._extract_f4m_formats(
+                    format_url + '?hdcore=3.2.0', media_id, f4m_id='hds', fatal=False))
             elif asset_type == 'HLS':
-                m3u8_formats = self._extract_m3u8_formats(
-                    format_url, media_id, 'mp4', 'm3u8_native', m3u8_id='hds', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                formats.extend(self._extract_m3u8_formats(
+                    format_url, media_id, 'mp4', 'm3u8_native', m3u8_id='hds', fatal=False))
             else:
                 format_info = {
                     'ext': xpath_text(asset, 'mediaType'),
index 03a4f446e9d80808b4e4b3df3ad5b3d0f8a550e3..c947337f9f3d54c730487c3e050c00a029bb2d1b 100644 (file)
@@ -469,11 +469,9 @@ class BrightcoveNewIE(InfoExtractor):
             if source_type == 'application/x-mpegURL':
                 if not src:
                     continue
-                m3u8_formats = self._extract_m3u8_formats(
+                formats.extend(self._extract_m3u8_formats(
                     src, video_id, 'mp4', entry_protocol='m3u8_native',
-                    m3u8_id='hls', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                    m3u8_id='hls', fatal=False))
             else:
                 streaming_src = source.get('streaming_src')
                 stream_name, app_name = source.get('stream_name'), source.get('app_name')
index 34a28c126e068aa55f072cc011016c63d945a409..65520744799013fbaa756d171cb10bff8a3e693e 100644 (file)
@@ -910,10 +910,8 @@ class InfoExtractor(object):
                 # may differ leading to inability to resolve the format by requested
                 # bitrate in f4m downloader
                 if determine_ext(manifest_url) == 'f4m':
-                    f4m_formats = self._extract_f4m_formats(
-                        manifest_url, video_id, preference, f4m_id, fatal=fatal)
-                    if f4m_formats:
-                        formats.extend(f4m_formats)
+                    formats.extend(self._extract_f4m_formats(
+                        manifest_url, video_id, preference, f4m_id, fatal=fatal))
                     continue
             tbr = int_or_none(media_el.attrib.get('bitrate'))
             formats.append({
@@ -1147,10 +1145,8 @@ class InfoExtractor(object):
             src_url = src if src.startswith('http') else compat_urlparse.urljoin(base, src)
 
             if proto == 'm3u8' or src_ext == 'm3u8':
-                m3u8_formats = self._extract_m3u8_formats(
-                    src_url, video_id, ext or 'mp4', m3u8_id='hls', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                formats.extend(self._extract_m3u8_formats(
+                    src_url, video_id, ext or 'mp4', m3u8_id='hls', fatal=False))
                 continue
 
             if src_ext == 'f4m':
@@ -1162,9 +1158,7 @@ class InfoExtractor(object):
                     }
                 f4m_url += '&' if '?' in f4m_url else '?'
                 f4m_url += compat_urllib_parse.urlencode(f4m_params)
-                f4m_formats = self._extract_f4m_formats(f4m_url, video_id, f4m_id='hds', fatal=False)
-                if f4m_formats:
-                    formats.extend(f4m_formats)
+                formats.extend(self._extract_f4m_formats(f4m_url, video_id, f4m_id='hds', fatal=False))
                 continue
 
             if src_url.startswith('http') and self._is_valid_url(src, video_id):
index 0c5b6617f0e38a720c4468d393c4f185ebe6d27b..439fd42e81642a69e9ee37122ca7e9fa6b24b5ee 100644 (file)
@@ -148,15 +148,11 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
                         continue
                     ext = determine_ext(media_url)
                     if type_ == 'application/x-mpegURL' or ext == 'm3u8':
-                        m3u8_formats = self._extract_m3u8_formats(
-                            media_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
-                        if m3u8_formats:
-                            formats.extend(m3u8_formats)
+                        formats.extend(self._extract_m3u8_formats(
+                            media_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
                     elif type_ == 'application/f4m' or ext == 'f4m':
-                        f4m_formats = self._extract_f4m_formats(
-                            media_url, video_id, preference=-1, f4m_id='hds', fatal=False)
-                        if f4m_formats:
-                            formats.extend(f4m_formats)
+                        formats.extend(self._extract_f4m_formats(
+                            media_url, video_id, preference=-1, f4m_id='hds', fatal=False))
                     else:
                         f = {
                             'url': media_url,
index 0d140f12fd8ea81d1c486f470bd4f83a2edf82d9..8f48571de2717fec01c4b574a2454cac7f5738c6 100644 (file)
@@ -56,10 +56,8 @@ class DCNBaseIE(InfoExtractor):
         m3u8_url = self._html_search_regex(
             r'file\s*:\s*"([^"]+)', webpage, 'm3u8 url', fatal=False)
         if m3u8_url:
-            m3u8_formats = self._extract_m3u8_formats(
-                m3u8_url, video_id, 'mp4', entry_protocol, m3u8_id='hls', fatal=None)
-            if m3u8_formats:
-                formats.extend(m3u8_formats)
+            formats.extend(self._extract_m3u8_formats(
+                m3u8_url, video_id, 'mp4', entry_protocol, m3u8_id='hls', fatal=None))
 
         rtsp_url = self._search_regex(
             r'<a[^>]+href="(rtsp://[^"]+)"', webpage, 'rtsp url', fatal=False)
index c83845fc2caaf7b1c4d382e4c77e98855c9c4d7a..713cb7b329208d3c761b12858cc265b401c16dd0 100644 (file)
@@ -65,18 +65,14 @@ class EitbIE(InfoExtractor):
             if token_data:
                 token = token_data.get('token')
                 if token:
-                    m3u8_formats = self._extract_m3u8_formats(
-                        '%s?hdnts=%s' % (hls_url, token), video_id, m3u8_id='hls', fatal=False)
-                    if m3u8_formats:
-                        formats.extend(m3u8_formats)
+                    formats.extend(self._extract_m3u8_formats(
+                        '%s?hdnts=%s' % (hls_url, token), video_id, m3u8_id='hls', fatal=False))
 
         hds_url = media.get('HDS_SURL')
         if hds_url:
-            f4m_formats = self._extract_f4m_formats(
+            formats.extend(self._extract_f4m_formats(
                 '%s?hdcore=3.7.0' % hds_url.replace('euskalsvod', 'euskalvod'),
-                video_id, f4m_id='hds', fatal=False)
-            if f4m_formats:
-                formats.extend(f4m_formats)
+                video_id, f4m_id='hds', fatal=False))
 
         self._sort_formats(formats)
 
index d1a95d87f14ab04b893b8cf239c2986ca0b602a4..0f37ed7863c93da4813a6ac6be2d6402fc7bbd0a 100644 (file)
@@ -151,11 +151,9 @@ class FunimationIE(InfoExtractor):
                         errors.append(format_url)
                         continue
                     if determine_ext(format_url) == 'm3u8':
-                        m3u8_formats = self._extract_m3u8_formats(
+                        formats.extend(self._extract_m3u8_formats(
                             format_url + auth_token, display_id, 'mp4', entry_protocol='m3u8_native',
-                            preference=preference, m3u8_id='%s-hls' % funimation_id, fatal=False)
-                        if m3u8_formats:
-                            formats.extend(m3u8_formats)
+                            preference=preference, m3u8_id='%s-hls' % funimation_id, fatal=False))
                     else:
                         tbr = int_or_none(self._search_regex(
                             r'-(\d+)[Kk]', format_url, 'tbr', default=None))
index 7f21d7410c4515e23c4ebde5895d56de3b8a8f79..4c4a87e2a3337bfb5de955a329c7edba2c338ad2 100644 (file)
@@ -51,10 +51,8 @@ class FunnyOrDieIE(InfoExtractor):
 
         formats = []
 
-        m3u8_formats = self._extract_m3u8_formats(
-            m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
-        if m3u8_formats:
-            formats.extend(m3u8_formats)
+        formats.extend(self._extract_m3u8_formats(
+            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()
index c65ef6bcf39d405faed9ac6d3c5cbbf3f666626c..b241c4868df34bd37efb13113ddac81a0b678a4c 100644 (file)
@@ -369,11 +369,9 @@ class GloboIE(InfoExtractor):
             resource_url = resource['url']
             signed_url = '%s?h=%s&k=%s' % (resource_url, signed_hash, 'flash')
             if resource_id.endswith('m3u8') or resource_url.endswith('.m3u8'):
-                m3u8_formats = self._extract_m3u8_formats(
+                formats.extend(self._extract_m3u8_formats(
                     signed_url, resource_id, 'mp4', entry_protocol='m3u8_native',
-                    m3u8_id='hls', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                    m3u8_id='hls', fatal=False))
             else:
                 formats.append({
                     'url': signed_url,
index 05d27e75de818f135ae1f55195723acaaf489101..a7c3ce4ab8402307d35c78ad21030abb6b1ffbe4 100644 (file)
@@ -55,9 +55,7 @@ class HotStarIE(InfoExtractor):
                 format_url = format_data['src']
                 ext = determine_ext(format_url)
                 if ext == 'm3u8':
-                    m3u8_formats = self._extract_m3u8_formats(format_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
-                    if m3u8_formats:
-                        formats.extend(m3u8_formats)
+                    formats.extend(self._extract_m3u8_formats(format_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
                 elif ext == 'f4m':
                     # produce broken files
                     continue
index a2e18c8a7ac8f5cb18e8521cdc9a40a7b5c35710..d1c1c210cfdee4b47cf09d38f64dfc41b99e76f8 100644 (file)
@@ -129,14 +129,10 @@ class IGNIE(InfoExtractor):
         formats = []
         m3u8_url = api_data['refs'].get('m3uUrl')
         if m3u8_url:
-            m3u8_formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
-            if m3u8_formats:
-                formats.extend(m3u8_formats)
+            formats.extend(self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
         f4m_url = api_data['refs'].get('f4mUrl')
         if f4m_url:
-            f4m_formats = self._extract_f4m_formats(f4m_url, video_id, f4m_id='hds', fatal=False)
-            if f4m_formats:
-                formats.extend(f4m_formats)
+            formats.extend(self._extract_f4m_formats(f4m_url, video_id, f4m_id='hds', fatal=False))
         for asset in api_data['assets']:
             formats.append({
                 'url': asset['url'],
index a92adf2b348aa5aeb160f306139d6090e6623553..8e90d59868c380d1f486d838d8b6f3283bdc2b58 100644 (file)
@@ -44,10 +44,8 @@ class JWPlatformIE(InfoExtractor):
             source_url = self._proto_relative_url(source['file'])
             source_type = source.get('type') or ''
             if source_type == 'application/vnd.apple.mpegurl':
-                m3u8_formats = self._extract_m3u8_formats(
-                    source_url, video_id, 'mp4', 'm3u8_native', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                formats.extend(self._extract_m3u8_formats(
+                    source_url, video_id, 'mp4', 'm3u8_native', fatal=False))
             elif source_type.startswith('audio'):
                 formats.append({
                     'url': source_url,
index 4807c81101d0f254c0263c37fd831896b6f5555b..ccbc39c665412980e6b6104e83ffaf2e8574517f 100644 (file)
@@ -163,10 +163,8 @@ class KalturaIE(InfoExtractor):
         m3u8_url = info['dataUrl'].replace('format/url', 'format/applehttp')
         if referrer:
             m3u8_url += '?referrer=%s' % referrer
-        m3u8_formats = self._extract_m3u8_formats(
-            m3u8_url, entry_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
-        if m3u8_formats:
-            formats.extend(m3u8_formats)
+        formats.extend(self._extract_m3u8_formats(
+            m3u8_url, entry_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
 
         self._check_formats(formats, entry_id)
         self._sort_formats(formats)
index 688eb23081c370c742e9190a24f0ff7c02f35bf9..38fb3d9e4166f5f4a188ab2436c27240a8b04283 100644 (file)
@@ -110,23 +110,17 @@ class LivestreamIE(InfoExtractor):
 
         smil_url = video_data.get('smil_url')
         if smil_url:
-            smil_formats = self._extract_smil_formats(smil_url, video_id)
-            if smil_formats:
-                formats.extend(smil_formats)
+            formats.extend(self._extract_smil_formats(smil_url, video_id))
 
         m3u8_url = video_data.get('m3u8_url')
         if m3u8_url:
-            m3u8_formats = self._extract_m3u8_formats(
-                m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
-            if m3u8_formats:
-                formats.extend(m3u8_formats)
+            formats.extend(self._extract_m3u8_formats(
+                m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
 
         f4m_url = video_data.get('f4m_url')
         if f4m_url:
-            f4m_formats = self._extract_f4m_formats(
-                f4m_url, video_id, f4m_id='hds', fatal=False)
-            if f4m_formats:
-                formats.extend(f4m_formats)
+            formats.extend(self._extract_f4m_formats(
+                f4m_url, video_id, f4m_id='hds', fatal=False))
         self._sort_formats(formats)
 
         comments = [{
@@ -158,17 +152,13 @@ class LivestreamIE(InfoExtractor):
         formats = []
         smil_url = stream_info.get('play_url')
         if smil_url:
-            smil_formats = self._extract_smil_formats(smil_url, broadcast_id)
-            if smil_formats:
-                formats.extend(smil_formats)
+            formats.extend(self._extract_smil_formats(smil_url, broadcast_id))
 
         entry_protocol = 'm3u8' if is_live else 'm3u8_native'
         m3u8_url = stream_info.get('m3u8_url')
         if m3u8_url:
-            m3u8_formats = self._extract_m3u8_formats(
-                m3u8_url, broadcast_id, 'mp4', entry_protocol, m3u8_id='hls', fatal=False)
-            if m3u8_formats:
-                formats.extend(m3u8_formats)
+            formats.extend(self._extract_m3u8_formats(
+                m3u8_url, broadcast_id, 'mp4', entry_protocol, m3u8_id='hls', fatal=False))
 
         rtsp_url = stream_info.get('rtsp_url')
         if rtsp_url:
@@ -293,10 +283,8 @@ class LivestreamOriginalIE(InfoExtractor):
 
         m3u8_url = video_data.get('httpUrl')
         if m3u8_url:
-            m3u8_formats = self._extract_m3u8_formats(
-                m3u8_url, video_id, 'mp4', entry_protocol, m3u8_id='hls', fatal=False)
-            if m3u8_formats:
-                formats.extend(m3u8_formats)
+            formats.extend(self._extract_m3u8_formats(
+                m3u8_url, video_id, 'mp4', entry_protocol, m3u8_id='hls', fatal=False))
 
         rtsp_url = video_data.get('rtspUrl')
         if rtsp_url:
index 7c6b7841db251d3ee2178de680e60cbb6900b0fc..9d26030d3a43e11b0430aecbc5506ab10a1e5973 100644 (file)
@@ -68,13 +68,9 @@ class NBAIE(InfoExtractor):
             if video_url.startswith('/'):
                 continue
             if video_url.endswith('.m3u8'):
-                m3u8_formats = self._extract_m3u8_formats(video_url, video_id, m3u8_id='hls', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                formats.extend(self._extract_m3u8_formats(video_url, video_id, m3u8_id='hls', fatal=False))
             elif video_url.endswith('.f4m'):
-                f4m_formats = self._extract_f4m_formats(video_url + '?hdcore=3.4.1.1', video_id, f4m_id='hds', fatal=False)
-                if f4m_formats:
-                    formats.extend(f4m_formats)
+                formats.extend(self._extract_f4m_formats(video_url + '?hdcore=3.4.1.1', video_id, f4m_id='hds', fatal=False))
             else:
                 key = video_file.attrib.get('bitrate')
                 format_info = {
index 8603fd692d0f7b46b6a3150045b0d0148420d7b5..3960d522edd4d4e9dc92577fd2791c2b492d5c0e 100644 (file)
@@ -44,17 +44,11 @@ class OoyalaBaseIE(InfoExtractor):
                     urls.append(url)
                     delivery_type = stream['delivery_type']
                     if delivery_type == 'hls' or '.m3u8' in url:
-                        m3u8_formats = self._extract_m3u8_formats(url, embed_code, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
-                        if m3u8_formats:
-                            formats.extend(m3u8_formats)
+                        formats.extend(self._extract_m3u8_formats(url, embed_code, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
                     elif delivery_type == 'hds' or '.f4m' in url:
-                        f4m_formats = self._extract_f4m_formats(url, embed_code, f4m_id='hds', fatal=False)
-                        if f4m_formats:
-                            formats.extend(f4m_formats)
+                        formats.extend(self._extract_f4m_formats(url, embed_code, f4m_id='hds', fatal=False))
                     elif '.smil' in url:
-                        smil_formats = self._extract_smil_formats(url, embed_code, fatal=False)
-                        if smil_formats:
-                            formats.extend(smil_formats)
+                        formats.extend(self._extract_smil_formats(url, embed_code, fatal=False))
                     else:
                         formats.append({
                             'url': url,
index 278b1d2bf9b154308d565c1555cb46393118ef78..f2679591bc8a0ddea46aafe8d4e6dc64cfcf7c20 100644 (file)
@@ -116,17 +116,13 @@ class RaiTVIE(InfoExtractor):
                 ext = determine_ext(media_url)
                 content_type = xpath_text(element, 'content-type')
                 if ext == 'm3u8':
-                    m3u8_formats = self._extract_m3u8_formats(
+                    formats.extend(self._extract_m3u8_formats(
                         media_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls',
-                        fatal=False)
-                    if m3u8_formats:
-                        formats.extend(m3u8_formats)
+                        fatal=False))
                 elif ext == 'f4m':
-                    f4m_formats = self._extract_f4m_formats(
+                    formats.extend(self._extract_f4m_formats(
                         media_url + '?hdcore=3.7.0&plugin=aasp-3.7.0.39.44',
-                        video_id, f4m_id='hds', fatal=False)
-                    if f4m_formats:
-                        formats.extend(f4m_formats)
+                        video_id, f4m_id='hds', fatal=False))
                 elif ext == 'stl':
                     has_subtitle = True
                 elif content_type.startswith('video/'):
index 9db62adb1b95343a10774a9b7bfb23e090c28d9d..c5c47d01ecef917ce037fc0ede75dd2b5e770138 100644 (file)
@@ -58,15 +58,11 @@ class RutubeIE(InfoExtractor):
         for format_id, format_url in options['video_balancer'].items():
             ext = determine_ext(format_url)
             if ext == 'm3u8':
-                m3u8_formats = self._extract_m3u8_formats(
-                    format_url, video_id, 'mp4', m3u8_id=format_id, fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                formats.extend(self._extract_m3u8_formats(
+                    format_url, video_id, 'mp4', m3u8_id=format_id, fatal=False))
             elif ext == 'f4m':
-                f4m_formats = self._extract_f4m_formats(
-                    format_url, video_id, f4m_id=format_id, fatal=False)
-                if f4m_formats:
-                    formats.extend(f4m_formats)
+                formats.extend(self._extract_f4m_formats(
+                    format_url, video_id, f4m_id=format_id, fatal=False))
             else:
                 formats.append({
                     'url': format_url,
index e417bf66147a7d6d8dc9d604fd7fed09acb873ca..41fddc3758ebdbe22d30bd07d7bf0234656e2149 100644 (file)
@@ -63,15 +63,11 @@ class RuutuIE(InfoExtractor):
                     processed_urls.append(video_url)
                     ext = determine_ext(video_url)
                     if ext == 'm3u8':
-                        m3u8_formats = self._extract_m3u8_formats(
-                            video_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
-                        if m3u8_formats:
-                            formats.extend(m3u8_formats)
+                        formats.extend(self._extract_m3u8_formats(
+                            video_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
                     elif ext == 'f4m':
-                        f4m_formats = self._extract_f4m_formats(
-                            video_url, video_id, f4m_id='hds', fatal=False)
-                        if f4m_formats:
-                            formats.extend(f4m_formats)
+                        formats.extend(self._extract_f4m_formats(
+                            video_url, video_id, f4m_id='hds', fatal=False))
                     else:
                         proto = compat_urllib_parse_urlparse(video_url).scheme
                         if not child.tag.startswith('HTTP') and proto != 'rtmp':
index a363b4d403dc741bc9993daba9599a94f385fef8..fe11c20df7f71da210586556705cce3f9bd99de2 100644 (file)
@@ -57,9 +57,7 @@ class Tele13IE(InfoExtractor):
             if format_url and format_url not in urls:
                 ext = determine_ext(format_url)
                 if ext == 'm3u8':
-                    m3u8_formats = self._extract_m3u8_formats(format_url, display_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
-                    if m3u8_formats:
-                        formats.extend(m3u8_formats)
+                    formats.extend(self._extract_m3u8_formats(format_url, display_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
                 elif YoutubeIE.suitable(format_url):
                     return self.url_result(format_url, 'Youtube')
                 else:
index a47239952106f792ab91602c2a5f6be0ebca2657..c54b876d39678837bad4f7e5715fc02ddec747c1 100644 (file)
@@ -132,13 +132,11 @@ class ToggleIE(InfoExtractor):
             vid_format = vid_format.replace(' ', '')
             # if geo-restricted, m3u8 is inaccessible, but mp4 is okay
             if ext == 'm3u8':
-                m3u8_formats = self._extract_m3u8_formats(
+                formats.extend(self._extract_m3u8_formats(
                     video_url, video_id, ext='mp4', m3u8_id=vid_format,
                     note='Downloading %s m3u8 information' % vid_format,
                     errnote='Failed to download %s m3u8 information' % vid_format,
-                    fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                    fatal=False))
             elif ext in ('mp4', 'wvm'):
                 # wvm are drm-protected files
                 formats.append({
index 129668a99ea12cbda5c9784ca4ca0e2251b304e4..86ba70ed9ea4525b9d8f82f35be8e73ea2ccc697 100644 (file)
@@ -151,10 +151,8 @@ class VGTVIE(XstreamIE):
 
         hls_url = streams.get('hls')
         if hls_url:
-            m3u8_formats = self._extract_m3u8_formats(
-                hls_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
-            if m3u8_formats:
-                formats.extend(m3u8_formats)
+            formats.extend(self._extract_m3u8_formats(
+                hls_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
 
         hds_url = streams.get('hds')
         if hds_url:
index 9a1c377a413aaf2b05c538703be5a1867daf84d5..433fc9914a1d59fbc6743e8e82815b429a695cc5 100644 (file)
@@ -277,11 +277,9 @@ class VikiIE(VikiBaseIE):
                 r'^(\d+)[pP]$', format_id, 'height', default=None))
             for protocol, format_dict in stream_dict.items():
                 if format_id == 'm3u8':
-                    m3u8_formats = self._extract_m3u8_formats(
+                    formats.extend(self._extract_m3u8_formats(
                         format_dict['url'], video_id, 'mp4', 'm3u8_native',
-                        m3u8_id='m3u8-%s' % protocol, fatal=False)
-                    if m3u8_formats:
-                        formats.extend(m3u8_formats)
+                        m3u8_id='m3u8-%s' % protocol, fatal=False))
                 else:
                     formats.append({
                         'url': format_dict['url'],
index ce08e69559370c1fed3e393cee729fdac40119e6..7af6999821dd569e4984b79559708ef5320d545e 100644 (file)
@@ -437,10 +437,8 @@ class VimeoIE(VimeoBaseInfoExtractor):
             })
         m3u8_url = config_files.get('hls', {}).get('url')
         if m3u8_url:
-            m3u8_formats = self._extract_m3u8_formats(
-                m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
-            if m3u8_formats:
-                formats.extend(m3u8_formats)
+            formats.extend(self._extract_m3u8_formats(
+                m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
         # Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
         # at the same time without actual units specified. This lead to wrong sorting.
         self._sort_formats(formats, field_preference=('preference', 'height', 'width', 'fps', 'format_id'))
index ef096cbd248def4c67a1046c326ce7d1fd6a8796..e8511398c299f5ab89fbeea6c145ac41c13a0210 100644 (file)
@@ -157,16 +157,12 @@ class WDRIE(InfoExtractor):
         preference = qualities(['S', 'M', 'L', 'XL'])
 
         if video_url.endswith('.f4m'):
-            f4m_formats = self._extract_f4m_formats(video_url + '?hdcore=3.2.0&plugin=aasp-3.2.0.77.18', page_id, f4m_id='hds', fatal=False)
-            if f4m_formats:
-                formats.extend(f4m_formats)
+            formats.extend(self._extract_f4m_formats(video_url + '?hdcore=3.2.0&plugin=aasp-3.2.0.77.18', page_id, f4m_id='hds', fatal=False))
         elif video_url.endswith('.smil'):
-            smil_formats = self._extract_smil_formats(video_url, page_id, False, {
+            formats.extend(self._extract_smil_formats(video_url, page_id, False, {
                 'hdcore': '3.3.0',
                 'plugin': 'aasp-3.3.0.99.43',
-            })
-            if smil_formats:
-                formats.extend(smil_formats)
+            }))
         else:
             formats.append({
                 'url': video_url,
@@ -177,9 +173,7 @@ class WDRIE(InfoExtractor):
 
         m3u8_url = self._search_regex(r'rel="adaptiv"[^>]+href="([^"]+)"', webpage, 'm3u8 url', default=None)
         if m3u8_url:
-            m3u8_formats = self._extract_m3u8_formats(m3u8_url, page_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
-            if m3u8_formats:
-                formats.extend(m3u8_formats)
+            formats.extend(self._extract_m3u8_formats(m3u8_url, page_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
 
         direct_urls = re.findall(r'rel="web(S|M|L|XL)"[^>]+href="([^"]+)"', webpage)
         if direct_urls:
index 92c12bac63a3bcf7a9105b70bd266dd769cb976c..2a1f2f6d138d9d24bb6025e01aaa79265ed17343 100644 (file)
@@ -125,20 +125,14 @@ class ZDFIE(InfoExtractor):
             if ext == 'meta':
                 continue
             elif ext == 'smil':
-                smil_formats = self._extract_smil_formats(
-                    video_url, video_id, fatal=False)
-                if smil_formats:
-                    formats.extend(smil_formats)
+                formats.extend(self._extract_smil_formats(
+                    video_url, video_id, fatal=False))
             elif ext == 'm3u8':
-                m3u8_formats = self._extract_m3u8_formats(
-                    video_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
-                if m3u8_formats:
-                    formats.extend(m3u8_formats)
+                formats.extend(self._extract_m3u8_formats(
+                    video_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
             elif ext == 'f4m':
-                f4m_formats = self._extract_f4m_formats(
-                    video_url, video_id, f4m_id='hds', fatal=False)
-                if f4m_formats:
-                    formats.extend(f4m_formats)
+                formats.extend(self._extract_f4m_formats(
+                    video_url, video_id, f4m_id='hds', fatal=False))
             else:
                 proto = format_m.group('proto').lower()