Repository: yt-dlp
Issue: [Jamendo] Embedding thumbnails causes downloads to fail
Labels: site-bug,patch-available

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that yt-dlp is broken on a **supported** site
- [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [ ] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

United States (Though it should be accessible from most countries)

### Provide a description that is worded well enough to be understood

When using the --embed-thumbnail flag to attempt to embed thumbnails while downloading an album of Jamendo songs, it fails on every track with the error:
```
ERROR: The extracted extension ('com') is unusual and will be skipped for safety reasons. If you believe this is an error, please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
```
This happens regardless of whether I am downloading an album or a single track, and nothing is downloaded.

From what I can tell, on Jamendo, thumbnails are stored on `usercontent.jamendo.com` with a path of `/` (no file extension or anything) and all specific information is in the query string.
Example: `https://usercontent.jamendo.com/?type=album&id=83048&width=300&trackid=711265`
This may have caused the extractor to think the file extension is `.com` because it is directly after the last period in the string, and flagged it because `.com` also happens to be the file extension of an old MS-DOS executable format.
When visiting the image url above, the `content-type` response header reads `image/jpeg`, indicating that the file is an image instead of a `com` executable. However, when downloading the album associated with that album art using --embed-thumbnail (`yt-dlp --embed-thumbnail "https://www.jamendo.com/album/83048/anitek-instrumentals-vol-7"`), it fails with the above error. Note that omitting the embed thumbnail option successfully downloads a series of thumbnail-less FLAC files.

### Provide verbose output that clearly demonstrates the problem

- [X] 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
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
$ yt-dlp -vU --embed-thumbnail "https://www.jamendo.com/track/711265/dont-leave-me"
[debug] Command-line config: ['-vU', '--embed-thumbnail', 'https://www.jamendo.com/track/711265/dont-leave-me']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.12.06 from yt-dlp/yt-dlp [4bd265539] (zip)
[debug] Python 3.13.0 (CPython x86_64 64bit) - Linux-6.11.10-300.fc41.x86_64-x86_64-with-glibc2.40 (OpenSSL 3.2.2 4 Jun 2024, glibc 2.40)
[debug] exe versions: ffmpeg 7.0.2 (setts), ffprobe 7.0.2, phantomjs broken
[debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2023.05.07, mutagen-1.47.0, requests-2.32.3, sqlite3-3.46.1, urllib3-1.26.20, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests
[debug] Loaded 1837 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.12.06 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.12.06 from yt-dlp/yt-dlp)
[Jamendo] Extracting URL: https://www.jamendo.com/track/711265/dont-leave-me
[Jamendo] 711265: Downloading JSON metadata
[Jamendo] 359034: Downloading JSON metadata
[Jamendo] 83048: Downloading JSON metadata
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec, channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 711265: Downloading 1 format(s): flac
ERROR: The extracted extension ('com') is unusual and will be skipped for safety reasons. If you believe this is an error, please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
Traceback (most recent call last):
  File "/home/oirnoir/.local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 177, in wrapper
    return func(self, *args, **kwargs)
  File "/home/oirnoir/.local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3272, in process_info
    thumb_files = self._write_thumbnails(
        'video', info_dict, temp_filename, self.prepare_filename(info_dict, 'thumbnail'))
  File "/home/oirnoir/.local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 4388, in _write_thumbnails
    thumb_filename = replace_extension(filename, thumb_ext, info_dict.get('ext'))
  File "/home/oirnoir/.local/bin/yt-dlp/yt_dlp/utils/_utils.py", line 2130, in _change_extension
    return f'{filename}.{_UnsafeExtensionError.sanitize_extension(ext)}'
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/home/oirnoir/.local/bin/yt-dlp/yt_dlp/utils/_utils.py", line 5212, in sanitize_extension
    raise cls(extension)
yt_dlp.utils._UnsafeExtensionError: unsafe file extension: 'com'
```