From fb04e40396509fd2bd41250eec3b07adf1aa1125 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Mon, 25 Nov 2013 22:34:56 +0100 Subject: [PATCH] [soundcloud] Support for listing of audio-only files --- youtube_dl/YoutubeDL.py | 5 ++++- youtube_dl/extractor/soundcloud.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index d0aab1bbd..87635e173 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -875,6 +875,8 @@ class YoutubeDL(object): @staticmethod def format_resolution(format, default='unknown'): + if format.get('vcodec') == 'none': + return 'audio only' if format.get('_resolution') is not None: return format['_resolution'] if format.get('height') is not None: @@ -891,7 +893,8 @@ class YoutubeDL(object): res = u'' if fdict.get('format_note') is not None: res += fdict['format_note'] + u' ' - if fdict.get('vcodec') is not None: + if (fdict.get('vcodec') is not None and + fdict.get('vcodec') != 'none'): res += u'%-5s' % fdict['vcodec'] elif fdict.get('vbr') is not None: res += u'video' diff --git a/youtube_dl/extractor/soundcloud.py b/youtube_dl/extractor/soundcloud.py index ee8da227e..3a19ab172 100644 --- a/youtube_dl/extractor/soundcloud.py +++ b/youtube_dl/extractor/soundcloud.py @@ -100,6 +100,7 @@ class SoundcloudIE(InfoExtractor): 'format_id': 'download', 'ext': ext, 'url': format_url, + 'vcodec': 'none', }] else: # We have to retrieve the url @@ -115,6 +116,7 @@ class SoundcloudIE(InfoExtractor): 'format_id': key, 'ext': ext, 'url': stream_url, + 'vcodec': 'none', }) elif key.startswith(u'rtmp'): # The url doesn't have an rtmp app, we have to extract the playpath @@ -124,6 +126,7 @@ class SoundcloudIE(InfoExtractor): 'url': url, 'play_path': 'mp3:' + path, 'ext': ext, + 'vcodec': 'none', }) if not formats: @@ -133,6 +136,7 @@ class SoundcloudIE(InfoExtractor): 'format_id': u'fallback', 'url': info['stream_url'] + '?client_id=' + self._CLIENT_ID, 'ext': ext, + 'vcodec': 'none', }) def format_pref(f): -- 2.22.2