Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merge

  • Loading branch information...
commit 54bd41ad05fb39d9e1af60cda8092783e03749fc 2 parents 48dbfb3 + 4dbc4c4
@ngokevin authored
Showing with 3 additions and 4 deletions.
  1. +1 −0  .gitignore
  2. +2 −4 soundcloud.py
View
1  .gitignore
@@ -0,0 +1 @@
+*.pyc
View
6 soundcloud.py
@@ -40,6 +40,7 @@ def get_song_title(page):
def download(uid, token, song_title='soundcloud_dl.mp3'):
""" given url with token and uid, download file to mp3 """
+ # compose a url with uid and token and request the mpeg
url = "http://media.soundcloud.com/stream/%s?stream_token=%s" % (uid, token)
request = urllib2.Request(url, headers=header_values)
response = opener.open(request)
@@ -47,6 +48,7 @@ def download(uid, token, song_title='soundcloud_dl.mp3'):
f = open(song_title, 'w')
f.write(response.read())
+
if __name__ == '__main__':
parser = OptionParser()
@@ -66,9 +68,5 @@ def download(uid, token, song_title='soundcloud_dl.mp3'):
# the browser does this...so we will too
open_url('http://media.soundcloud.com/crossdomain.xml')
- # compose a url with uid and token and request the mpeg
download(uid, token, song_title)
-
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.