]> gitweb @ CieloNegro.org - youtube-dl.git/blobdiff - youtube_dl/extractor/soundcloud.py
[soundcloud] Extract hls formats
[youtube-dl.git] / youtube_dl / extractor / soundcloud.py
index 1a8114aa7d197ffa1da08a0560dde2736765db66..55c80e1cc298cd3339e4fc559acd42d5fbafe704 100644 (file)
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# coding: utf-8
 from __future__ import unicode_literals
 
 import re
@@ -121,7 +121,7 @@ class SoundcloudIE(InfoExtractor):
         },
     ]
 
-    _CLIENT_ID = '02gUJC0hH2ct1EGOcYXQIzRFU91c72Ea'
+    _CLIENT_ID = 'fDoItMDbsbZz8dY16ZzARCZmzgHBPotA'
     _IPHONE_CLIENT_ID = '376f225bf427445fc4bfb6b99b72e0bf'
 
     @staticmethod
@@ -173,11 +173,12 @@ class SoundcloudIE(InfoExtractor):
             })
 
         # 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))
         format_dict = self._download_json(
-            streams_url,
-            track_id, 'Downloading track url')
+            'http://api.soundcloud.com/i1/tracks/%s/streams' % track_id,
+            track_id, 'Downloading track url', query={
+                'client_id': self._CLIENT_ID,
+                'secret_token': secret_token,
+            })
 
         for key, stream_url in format_dict.items():
             if key.startswith('http'):
@@ -197,6 +198,13 @@ class SoundcloudIE(InfoExtractor):
                     'ext': 'flv',
                     'vcodec': 'none',
                 })
+            elif key.startswith('hls'):
+                m3u8_formats = self._extract_m3u8_formats(
+                    stream_url, track_id, 'mp3', entry_protocol='m3u8_native',
+                    m3u8_id=key, fatal=False)
+                for f in m3u8_formats:
+                    f['vcodec'] = 'none'
+                formats.extend(m3u8_formats)
 
             if not formats:
                 # We fallback to the stream_url in the original info, this