Skip to content

Removed mixcloud urls are not handled gracefully. #44

@emt84

Description

@emt84

When the NTS api returns a deleted mixcloud url the tool does not fall back on the soundcloud url.

This can manually be fixed by swapping the order of the operands on the or function on line 68 of downloader.py but this is a poor experience for the end user. For example:

link = api_data.get('audio_sources', [{'url': ''}])[0].get('url', '') or api_data.get('mixcloud', '')

An example show that can be used to test fixes to this feature is here

example output:

downloading into: C:\Users\emt84\Downloads

[mixcloud] Extracting URL: https://www.mixcloud.com/NTSRadio/in-focus-sophie-12th-september-2025/ 
[mixcloud] NTSRadio_in-focus-sophie-12th-september-2025: Downloading JSON metadata 
ERROR: [mixcloud] Track not found 
Traceback (most recent call last):
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\YoutubeDL.py", line 1626, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\YoutubeDL.py", line 1761, in __extract_info
    ie_result = ie.extract(url)
                ^^^^^^^^^^^^^^^
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\extractor\common.py", line 740, in extract
    ie_result = self._real_extract(url)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\extractor\mixcloud.py", line 142, in _real_extract
    raise ExtractorError('Track not found', expected=True)
yt_dlp.utils.ExtractorError: [mixcloud] Track not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\emt84\Documents\nts\nts\cli.py", line 101, in <module>
    main()
  File "C:\Users\emt84\Documents\nts\nts\cli.py", line 97, in main
    url_matcher(arg)
  File "C:\Users\emt84\Documents\nts\nts\cli.py", line 74, in url_matcher
    nts.download(url=url,
  File "C:\Users\emt84\Documents\nts\nts\downloader.py", line 101, in download
    ydl.download([link])
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\YoutubeDL.py", line 3607, in download
    self.__download_wrapper(self.extract_info)(
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\YoutubeDL.py", line 3582, in wrapper
    res = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\YoutubeDL.py", line 1615, in extract_info
    return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\YoutubeDL.py", line 1644, in wrapper
    self.report_error(str(e), e.format_traceback())
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\YoutubeDL.py", line 1092, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
  File "C:\Users\emt84\AppData\Local\Programs\Python\Python312\Lib\site-packages\yt_dlp\YoutubeDL.py", line 1031, in trouble
    raise DownloadError(message, exc_info)
yt_dlp.utils.DownloadError: ERROR: [mixcloud] Track not found```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions