@@ -0,0 +1,1832 @@
+import soundcloud%0Aimport urllib.request%0Aimport os%0A%0ACLIENT_ID=%22Please your APP ID here , check Soundcloud doc%22%0A%0Aclass SCDownloader(object):%0A%09def __init__(self,client_id,):%09%09%0A%09%09self.client = soundcloud.Client(client_id=client_id)%0A%0A%09def downloadTrack(self,track,outputDir=None):%09%09%0A%0A%09%09stream_url=None%0A%09%09title=None%0A%09%09#if map , i.e Track object%0A%09%09if(hasattr(track,%22__iter__%22)):%0A%09%09%09if 'stream_url' in track:%0A%09%09%09%09stream_url=track%5B'stream_url'%5D%0A%09%09%09%09title=track%5B'title'%5D%0A%09%09%09%09original_format=track%5B'original_format'%5D%09%0A%09%09else:%0A%09%09%09stream_url=track.stream_url%0A%09%09%09title=track.title%0A%09%09%09original_format=track.original_format%09%0A%0A%09%09downloadUrl=self.extractDownloadableStreamUrl(stream_url)%09%0A%09%09outputFileName=title+%22.%22+original_format%0A%09%09if outputDir!=None:%0A%09%09%09os.makedirs(outputDir,exist_ok=True) %0A%09%09%09outputFileName=outputDir+%22/%22+outputFileName%09%09%0A%09%09self.download(downloadUrl,outputFileName)%0A%0A%09def downloadURL(self,url,outputDir=None):%09%09%0A%09%09resource = self.client.get('/resolve', url=url)%09%09%09%0A%09%09if resource.kind==%22track%22:%0A%09%09%09self.downloadTrack(resource,outputDir)%0A%09%09elif resource.tracks!=None:%0A%09%09%09for track in resource.tracks:%0A%09%09%09%09self.downloadTrack(track,outputDir+%22/%22+resource.title if (outputDir!=None) else resource.title)%0A%0A%09def extractDownloadableStreamUrl(self,stream_url):%0A%09%09stream_url = self.client.get(stream_url, allow_redirects=False)%09%09%09%0A%09%09return stream_url.location%0A%09%0A%09def download(self,url,fileName):%0A%09%09data = urllib.request.urlopen(url)%0A%09%09print(%22downloading%22+url)%0A%09%09with open(fileName, 'wb') as outputFile:%0A%09%09%09outputFile.write(data.read())%0A%09%09%0A%0Asc=SCDownloader(CLIENT_ID)%0Aurl=%22https://soundcloud.com/ahmed-abd-el-hamid-1/z2k6bs1e553c%22%0Asc.downloadURL(url,%22%22%22C:/Users/Mohamed/Downloads/SCDownloader/%22%22%22)%0A%0A%0A#http://api.soundcloud.com/resolve.json?url=https://soundcloud.com/rehab-hany/sets/3frwwndnpirl&client_id=af2bb48f2f847e46e0ed26061554b3be%0A

Create SCDownloader.py