[soundcloud] Handle 'secret_token' for 'w.soundcloud.com/player/?url=*' urls (fixes...
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 17 Apr 2015 08:46:25 +0000 (10:46 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 17 Apr 2015 08:46:25 +0000 (10:46 +0200)
youtube_dl/extractor/soundcloud.py

index 316b2c90f110770299084889552b8137e072a617..7efc6aff1f944b7f0169e38d1625e17fcb097dce 100644 (file)
@@ -221,7 +221,12 @@ class SoundcloudIE(InfoExtractor):
                 info_json_url += "&secret_token=" + token
         elif mobj.group('player'):
             query = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
-            return self.url_result(query['url'][0])
+            real_url = query['url'][0]
+            # If the token is in the query of the original url we have to
+            # manually add it
+            if 'secret_token' in query:
+                real_url += '?secret_token=' + query['secret_token'][0]
+            return self.url_result(real_url)
         else:
             # extract uploader (which is in the url)
             uploader = mobj.group('uploader')