aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-09-20 21:55:57 +0700
committerSergey M․ <dstftw@gmail.com>2016-09-20 21:56:57 +0700
commitf62a77b99a73ed3acf8406efaa34d08c73682be3 (patch)
treeb1571b17de663018e23a0f6b48ae655e16944d7e /youtube_dl
parent4bfd294e2f83301921494c02e497cccf1a26cfd5 (diff)
[soundcloud] Modernize
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/soundcloud.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/youtube_dl/extractor/soundcloud.py b/youtube_dl/extractor/soundcloud.py
index 47b84809f..513c54829 100644
--- a/youtube_dl/extractor/soundcloud.py
+++ b/youtube_dl/extractor/soundcloud.py
@@ -143,21 +143,20 @@ class SoundcloudIE(InfoExtractor):
name = full_title or track_id
if quiet:
self.report_extraction(name)
- thumbnail = info['artwork_url']
- track_license = info['license']
- if thumbnail is not None:
+ thumbnail = info.get('artwork_url')
+ if isinstance(thumbnail, compat_str):
thumbnail = thumbnail.replace('-large', '-t500x500')
ext = 'mp3'
result = {
'id': track_id,
- 'uploader': info['user']['username'],
- 'upload_date': unified_strdate(info['created_at']),
+ 'uploader': info.get('user', {}).get('username'),
+ 'upload_date': unified_strdate(info.get('created_at')),
'title': info['title'],
- 'description': info['description'],
+ 'description': info.get('description'),
'thumbnail': thumbnail,
'duration': int_or_none(info.get('duration'), 1000),
'webpage_url': info.get('permalink_url'),
- 'license': track_license,
+ 'license': info.get('license'),
}
formats = []
if info.get('downloadable', False):
@@ -227,7 +226,6 @@ class SoundcloudIE(InfoExtractor):
raise ExtractorError('Invalid URL: %s' % url)
track_id = mobj.group('track_id')
- token = None
if track_id is not None:
info_json_url = 'http://api.soundcloud.com/tracks/' + track_id + '.json?client_id=' + self._CLIENT_ID