mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-10 00:58:17 +02:00
[soundcloud] Modernize
This commit is contained in:
parent
4bfd294e2f
commit
f62a77b99a
@ -143,21 +143,20 @@ def _extract_info_dict(self, info, full_title=None, quiet=False, secret_token=No
|
|||||||
name = full_title or track_id
|
name = full_title or track_id
|
||||||
if quiet:
|
if quiet:
|
||||||
self.report_extraction(name)
|
self.report_extraction(name)
|
||||||
thumbnail = info['artwork_url']
|
thumbnail = info.get('artwork_url')
|
||||||
track_license = info['license']
|
if isinstance(thumbnail, compat_str):
|
||||||
if thumbnail is not None:
|
|
||||||
thumbnail = thumbnail.replace('-large', '-t500x500')
|
thumbnail = thumbnail.replace('-large', '-t500x500')
|
||||||
ext = 'mp3'
|
ext = 'mp3'
|
||||||
result = {
|
result = {
|
||||||
'id': track_id,
|
'id': track_id,
|
||||||
'uploader': info['user']['username'],
|
'uploader': info.get('user', {}).get('username'),
|
||||||
'upload_date': unified_strdate(info['created_at']),
|
'upload_date': unified_strdate(info.get('created_at')),
|
||||||
'title': info['title'],
|
'title': info['title'],
|
||||||
'description': info['description'],
|
'description': info.get('description'),
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'duration': int_or_none(info.get('duration'), 1000),
|
'duration': int_or_none(info.get('duration'), 1000),
|
||||||
'webpage_url': info.get('permalink_url'),
|
'webpage_url': info.get('permalink_url'),
|
||||||
'license': track_license,
|
'license': info.get('license'),
|
||||||
}
|
}
|
||||||
formats = []
|
formats = []
|
||||||
if info.get('downloadable', False):
|
if info.get('downloadable', False):
|
||||||
@ -227,7 +226,6 @@ def _real_extract(self, url):
|
|||||||
raise ExtractorError('Invalid URL: %s' % url)
|
raise ExtractorError('Invalid URL: %s' % url)
|
||||||
|
|
||||||
track_id = mobj.group('track_id')
|
track_id = mobj.group('track_id')
|
||||||
token = None
|
|
||||||
|
|
||||||
if track_id is not None:
|
if track_id is not None:
|
||||||
info_json_url = 'http://api.soundcloud.com/tracks/' + track_id + '.json?client_id=' + self._CLIENT_ID
|
info_json_url = 'http://api.soundcloud.com/tracks/' + track_id + '.json?client_id=' + self._CLIENT_ID
|
||||||
|
Loading…
Reference in New Issue
Block a user