1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-09 12:42:28 +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 @@ def _extract_info_dict(self, info, full_title=None, quiet=False, secret_token=No
'description': info['description'],
'thumbnail': thumbnail,
}
formats = []
if info.get('downloadable', False):
# We can build a direct link to the song
format_url = (
'https://api.soundcloud.com/tracks/{0}/download?client_id={1}'.format(
track_id, self._CLIENT_ID))
result['formats'] = [{
formats.append({
'format_id': 'download',
'ext': info.get('original_format', 'mp3'),
'url': format_url,
'vcodec': 'none',
}]
else:
'preference': 10,
})
# We have to retrieve the url
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))
@ -143,7 +145,6 @@ def _extract_info_dict(self, info, full_title=None, quiet=False, secret_token=No
streams_url,
track_id, 'Downloading track url')
formats = []
format_dict = json.loads(stream_json)
for key, stream_url in format_dict.items():
if key.startswith('http'):