soimort/you-get · error · NotImplementedError

url

Error message

url

What it means

ximalaya_download only accepts URLs matching http://www.ximalaya.com/<uid>/sound/<id> exactly (plain http, with www). Anything else — https links, no-www, m.ximalaya.com mobile pages, or non-sound pages — falls to else and raises NotImplementedError(url), so the exception message is just the raw URL.

Source

Thrown at src/you_get/extractors/ximalaya.py:56

    urls = [url]
    print('Site:        %s' % site_info)
    print('title:       %s' % title)
    if info_only:
        if stream_id:
            print_stream_info(stream_id)
        else:
            for item in range(0, len(stream_types)):
                print_stream_info(item)
    if not info_only:
        print('Type:        MPEG-4 audio m4a')
        print('Size:        N/A')
        download_urls(urls, title, ext, size, output_dir = output_dir, merge = False)

def ximalaya_download(url, output_dir = '.', info_only = False, stream_id = None, **kwargs):
    if re.match(r'http://www\.ximalaya\.com/(\d+)/sound/(\d+)', url):
        id = match1(url, r'http://www\.ximalaya\.com/\d+/sound/(\d+)')
    else:
        raise NotImplementedError(url)
    ximalaya_download_by_id(id, output_dir = output_dir, info_only = info_only, stream_id = stream_id)

def ximalaya_download_page(playlist_url, output_dir = '.', info_only = False, stream_id = None, **kwargs):
    if re.match(r'http://www\.ximalaya\.com/(\d+)/album/(\d+)', playlist_url):
        page_content = get_content(playlist_url)
        pattern = re.compile(r'<li sound_id="(\d+)"')
        ids = pattern.findall(page_content)
        for id in ids:
            try:
                ximalaya_download_by_id(id, output_dir=output_dir, info_only=info_only, stream_id=stream_id)
            except(ValueError):
                print("something wrong with %s, perhaps paid item?" % id)
    else:
        raise NotImplementedError(playlist_url)
    
def ximalaya_download_playlist(url, output_dir='.', info_only=False, stream_id=None, **kwargs):
    match_result = re.match(r'http://www\.ximalaya\.com/(\d+)/album/(\d+)', url)
    if not match_result:

View on GitHub (pinned to 049548f3f3)

Solutions

  1. Normalize the URL to http://www.ximalaya.com/<uid>/sound/<id> before calling
  2. Or widen the regex to r'https?://(?:www\.|m\.)?ximalaya\.com/(\d+)/sound/(\d+)' (also allow the modern path without the numeric uid segment if needed)
  3. For album links, call the playlist downloader instead of the single-track downloader

Example fix

# before
if re.match(r'http://www\.ximalaya\.com/(\d+)/sound/(\d+)', url):
    id = match1(url, r'http://www\.ximalaya\.com/\d+/sound/(\d+)')
else:
    raise NotImplementedError(url)

# after
if re.match(r'https?://(?:www\.|m\.)?ximalaya\.com/(?:\d+/)?sound/(\d+)', url):
    id = match1(url, r'sound/(\d+)')
else:
    raise NotImplementedError(url)
Defensive patterns

Strategy: validation

Validate before calling

import re

def ximalaya_sound_url_supported(url):
    return re.match(r'http://www\.ximalaya\.com/\d+/sound/\d+', url) is not None

Try / catch

try:
    ximalaya_download(url, ...)
except NotImplementedError:
    print('normalize to http://www.ximalaya.com/<uid>/sound/<id>')

Prevention

When it happens

Trigger: Passing 'https://www.ximalaya.com/sound/123' or 'https://m.ximalaya.com/sound/123' (https and mobile hosts fail re.match(r'http://www\.ximalaya\.com/(\d+)/sound/(\d+)') at src/you_get/extractors/ximalaya.py:55).

Common situations: Every modern share link is https, so this fires constantly on copy-pasted URLs; mobile app share links using the m. subdomain; album links (which belong to ximalaya_download_playlist).

Related errors


AI-assisted analysis of soimort/you-get@049548f3f3 (2026-08-15). Data as JSON: /api/errors/d7af9cdbd9558fab. Report an issue: GitHub.