From 7330864fc72f1ec22498c3d9196cfa6f9d3d0f3b Mon Sep 17 00:00:00 2001 From: Harry Kwon Date: Sat, 13 Apr 2019 08:12:30 +0000 Subject: [PATCH 1/2] Added -original quality to Soundcloud thumbnails --- youtube_dl/extractor/soundcloud.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/soundcloud.py b/youtube_dl/extractor/soundcloud.py index 15da3496e..b35e32f8d 100644 --- a/youtube_dl/extractor/soundcloud.py +++ b/youtube_dl/extractor/soundcloud.py @@ -217,8 +217,15 @@ class SoundcloudIE(InfoExtractor): if quiet: self.report_extraction(name) thumbnail = info.get('artwork_url') or info.get('user', {}).get('avatar_url') + thumbnails = [] if isinstance(thumbnail, compat_str): - thumbnail = thumbnail.replace('-large', '-t500x500') + thumbnail = thumbnail.replace('-large', '-original') + thumbnails.append({ + 'url': thumbnail.replace('-original', '-t500x500'), + 'width': 500, + 'height': 500 + }) + thumbnails.append({'url': thumbnail}) username = try_get(info, lambda x: x['user']['username'], compat_str) def extract_count(key): @@ -231,6 +238,7 @@ class SoundcloudIE(InfoExtractor): 'title': title, 'description': info.get('description'), 'thumbnail': thumbnail, + 'thumbnails': thumbnails, 'duration': int_or_none(info.get('duration'), 1000), 'webpage_url': info.get('permalink_url'), 'license': info.get('license'), From 51bfe3e5980885def5d5a38ce2ac6ab068db3374 Mon Sep 17 00:00:00 2001 From: Harry Kwon Date: Sat, 13 Apr 2019 08:41:00 +0000 Subject: [PATCH 2/2] fixes: removed 'thumbnails field and extract all thumbnail formats --- youtube_dl/extractor/soundcloud.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/soundcloud.py b/youtube_dl/extractor/soundcloud.py index b35e32f8d..94c347ec1 100644 --- a/youtube_dl/extractor/soundcloud.py +++ b/youtube_dl/extractor/soundcloud.py @@ -219,13 +219,19 @@ class SoundcloudIE(InfoExtractor): thumbnail = info.get('artwork_url') or info.get('user', {}).get('avatar_url') thumbnails = [] if isinstance(thumbnail, compat_str): - thumbnail = thumbnail.replace('-large', '-original') thumbnails.append({ - 'url': thumbnail.replace('-original', '-t500x500'), + 'url': thumbnail, + 'width': 100, + 'height': 100 + }) + thumbnails.append({ + 'url': thumbnail.replace('-large', '-t500x500'), 'width': 500, 'height': 500 }) - thumbnails.append({'url': thumbnail}) + thumbnails.append({ + 'url': thumbnail.replace('-large', '-original'), + }) username = try_get(info, lambda x: x['user']['username'], compat_str) def extract_count(key): @@ -237,7 +243,6 @@ class SoundcloudIE(InfoExtractor): 'timestamp': unified_timestamp(info.get('created_at')), 'title': title, 'description': info.get('description'), - 'thumbnail': thumbnail, 'thumbnails': thumbnails, 'duration': int_or_none(info.get('duration'), 1000), 'webpage_url': info.get('permalink_url'),