diff options
author | Kevin Ngo <ngoke@onid.oregonstate.edu> | 2011-11-12 16:48:43 -0800 |
---|---|---|
committer | Kevin Ngo <ngoke@onid.oregonstate.edu> | 2011-11-12 16:48:43 -0800 |
commit | 871be928a89be62f89ec21a1d9cb700dbddcaeca (patch) | |
tree | 3093488016b13c1392fd56a3a4e5b52d7a0bba01 | |
parent | b20d4f8626783ae61f5865a4d9aa3f460053c9a4 (diff) |
now downloads soundcloud songs, need to polish title grabbing and file naming
-rwxr-xr-x | youtube-dl | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/youtube-dl b/youtube-dl index 6eafc30b1..949d2e532 100755 --- a/youtube-dl +++ b/youtube-dl @@ -3533,10 +3533,10 @@ class SoundcloudIE(InfoExtractor): self.report_extraction('%s/%s' % (uploader, slug_title)) # extract uid and access token - mobj = re.search('"uid":"([\w\d]+?)".*?stream_token=([\w\d]+)', page) + mobj = re.search('"uid":"([\w\d]+?)".*?stream_token=([\w\d]+)', webpage) if mobj: - video_id = match.group(1) - stream_token = match.group(2) + video_id = mobj.group(1) + stream_token = mobj.group(2) # construct media url (with uid/token) to request song mediaURL = "http://media.soundcloud.com/stream/%s?stream_token=%s" @@ -3544,17 +3544,18 @@ class SoundcloudIE(InfoExtractor): # description description = u'No description available' - mobj = re.search('track-description-value"><p>(.*?)</p>', page) + mobj = re.search('track-description-value"><p>(.*?)</p>', webpage) if mobj: description = mobj.group(1) # upload date - mobj = re.search("pretty-date'>on ([\w]+ [\d]+, [\d]+ \d+:\d+)</abbr></h2>", page) + upload_date = None + mobj = re.search("pretty-date'>on ([\w]+ [\d]+, [\d]+ \d+:\d+)</abbr></h2>", webpage) if mobj: try: - upload_date = datetime.datetime.strptime(match.group(1), '%B %d, %Y %H:%M').strftime('%Y%m%d') - except: - pass + upload_date = datetime.datetime.strptime(mobj.group(1), '%B %d, %Y %H:%M').strftime('%Y%m%d') + except Exception as e: + print str(e) # for soundcloud, a request must be made to a cross domain to establish # needed cookies @@ -3563,10 +3564,10 @@ class SoundcloudIE(InfoExtractor): try: self._downloader.process_info({ 'id': video_id, - 'url': video_url, + 'url': mediaURL, 'uploader': uploader, 'upload_date': upload_date, - 'title': video_title, + 'title': simple_title, 'stitle': simple_title, 'ext': u'mp3', 'format': u'NA', |