Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SoundCloud] Some cover arts are downloaded in 100x100 resolution instead of original size #11835

Open
9 of 11 tasks
pyxelr opened this issue Dec 17, 2024 · 1 comment
Open
9 of 11 tasks
Labels
patch-available There is patch available that should fix this issue. Someone needs to make a PR with it site-bug Issue with a specific website

Comments

@pyxelr
Copy link

pyxelr commented Dec 17, 2024

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Region

Poland

Provide a description that is worded well enough to be understood

Hi,

I am not entirely sure if it is a bug, but I’ve noticed that some SoundCloud cover arts (sample song) are downloaded in 100x100 dimensions, even though the original artwork is available in higher resolution.

To download the file, I use this command and obtain the following log:

❯ yt-dlp --add-metadata --parse-metadata "%(artists)l:%(meta_artist)s" --embed-thumbnail -o "%(artists)l - %(title)s.%(ext)s" https://soundcloud.com/shinpuru/miracle

[soundcloud] Extracting URL: https://soundcloud.com/shinpuru/miracle
[soundcloud] shinpuru/miracle: Downloading info JSON
[soundcloud] 1987169691: Downloading hls_aac format info JSON
[soundcloud] 1987169691: Downloading hls_mp3 format info JSON
[soundcloud] 1987169691: Downloading http_mp3 format info JSON
[soundcloud] 1987169691: Downloading hls_opus format info JSON
[MetadataParser] Parsed meta_artist from '%(artists)l': 'shinpuru'
[info] 1987169691: Downloading 1 format(s): hls_aac_160k
[info] Downloading video thumbnail 0 ...
[info] Writing video thumbnail 0 to: shinpuru - Miracle.png
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 11
[download] Destination: shinpuru - Miracle.m4a
[download] 100% of    2.16MiB in 00:00:00 at 5.86MiB/s
[FixupM4a] Correcting container of "shinpuru - Miracle.m4a"
[Metadata] Adding metadata to "shinpuru - Miracle.m4a"
[EmbedThumbnail] mutagen: Adding thumbnail to "shinpuru - Miracle.m4a"

The downloaded shinpuru - Miracle.m4a file has 100x100 cover art dimensions, while the original art seems to be 500x500.

This is not an issue for some other songs, such as this one being downloaded in the .opus format with 1999x1999 cover art.

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

[debug] Command-line config: ['-vU']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version [email protected] from yt-dlp/yt-dlp [542166962] (pip)
[debug] Python 3.12.7 (CPython AMD64 64bit) - Windows-11-10.0.26100-SP0 (OpenSSL 3.3.2 3 Sep 2024)
[debug] exe versions: ffmpeg 7.1-essentials_build-www.gyan.dev (setts), ffprobe 7.1-essentials_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.17, brotli-1.1.0, certifi-2024.08.30, mutagen-1.47.0, requests-2.32.3, sqlite3-3.47.0, urllib3-2.2.3, websockets-13.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1837 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: [email protected] from yt-dlp/yt-dlp
yt-dlp is up to date ([email protected] from yt-dlp/yt-dlp)
@pyxelr pyxelr added site-bug Issue with a specific website triage Untriaged issue labels Dec 17, 2024
@bashonly
Copy link
Member

The extractor currently finds the other thumbnail versions if they are .jpg, but not if they are .png.

Patch:

diff --git a/yt_dlp/extractor/soundcloud.py b/yt_dlp/extractor/soundcloud.py
index 66bc5f9c5..cc42567dd 100644
--- a/yt_dlp/extractor/soundcloud.py
+++ b/yt_dlp/extractor/soundcloud.py
@@ -52,7 +52,7 @@ class SoundcloudBaseIE(InfoExtractor):
     _API_VERIFY_AUTH_TOKEN = 'https://api-auth.soundcloud.com/connect/session%s'
     _HEADERS = {}
 
-    _IMAGE_REPL_RE = r'-([0-9a-z]+)\.jpg'
+    _IMAGE_REPL_RE = r'-[0-9a-z]+\.(jpg|png)'
 
     _ARTWORK_MAP = {
         'mini': 16,
@@ -330,7 +330,7 @@ def invalid_url(url):
                 for image_id, size in self._ARTWORK_MAP.items():
                     i = {
                         'id': image_id,
-                        'url': re.sub(self._IMAGE_REPL_RE, f'-{image_id}.jpg', thumbnail),
+                        'url': re.sub(self._IMAGE_REPL_RE, rf'-{image_id}.\1', thumbnail),
                     }
                     if image_id == 'tiny' and not artwork_url:
                         size = 18

@bashonly bashonly added patch-available There is patch available that should fix this issue. Someone needs to make a PR with it and removed triage Untriaged issue labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch-available There is patch available that should fix this issue. Someone needs to make a PR with it site-bug Issue with a specific website
Projects
None yet
Development

No branches or pull requests

2 participants