1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-25 07:47:55 +01:00

[soundcloud] Always add streaming formats

This commit is contained in:
Philipp Hagemeister 2014-03-24 02:21:17 +01:00
parent 83622b6d2f
commit 5e114e4bfe

View File

@ -124,18 +124,20 @@ class SoundcloudIE(InfoExtractor):
'description': info['description'], 'description': info['description'],
'thumbnail': thumbnail, 'thumbnail': thumbnail,
} }
formats = []
if info.get('downloadable', False): if info.get('downloadable', False):
# We can build a direct link to the song # We can build a direct link to the song
format_url = ( format_url = (
'https://api.soundcloud.com/tracks/{0}/download?client_id={1}'.format( 'https://api.soundcloud.com/tracks/{0}/download?client_id={1}'.format(
track_id, self._CLIENT_ID)) track_id, self._CLIENT_ID))
result['formats'] = [{ formats.append({
'format_id': 'download', 'format_id': 'download',
'ext': info.get('original_format', 'mp3'), 'ext': info.get('original_format', 'mp3'),
'url': format_url, 'url': format_url,
'vcodec': 'none', 'vcodec': 'none',
}] 'preference': 10,
else: })
# We have to retrieve the url # We have to retrieve the url
streams_url = ('http://api.soundcloud.com/i1/tracks/{0}/streams?' streams_url = ('http://api.soundcloud.com/i1/tracks/{0}/streams?'
'client_id={1}&secret_token={2}'.format(track_id, self._IPHONE_CLIENT_ID, secret_token)) 'client_id={1}&secret_token={2}'.format(track_id, self._IPHONE_CLIENT_ID, secret_token))
@ -143,7 +145,6 @@ class SoundcloudIE(InfoExtractor):
streams_url, streams_url,
track_id, 'Downloading track url') track_id, 'Downloading track url')
formats = []
format_dict = json.loads(stream_json) format_dict = json.loads(stream_json)
for key, stream_url in format_dict.items(): for key, stream_url in format_dict.items():
if key.startswith('http'): if key.startswith('http'):