soimort/you-get · error · NotImplementedError

playlist_url

Error message

playlist_url

What it means

ximalaya_download_page accepts only playlist URLs shaped http://www.ximalaya.com/<uid>/album/<id> (plain http, www, numeric uid). Any other form — https, mobile host, or a sound page — raises NotImplementedError(playlist_url) with the raw URL as the message.

Source

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

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:
        raise NotImplementedError(url)
    pages = []
    page_content = get_content(url)
    if page_content.find('<div class="pagingBar_wrapper"') == -1:
        pages.append(url)
    else:
        base_url = 'http://www.ximalaya.com/' + match_result.group(1) + '/album/' + match_result.group(2)
        html_str = '<a href=(\'|")\/' + match_result.group(1) + '\/album\/' + match_result.group(2) + '\?page='
        count = len(re.findall(html_str, page_content))
        for page_num in range(count):
            pages.append(base_url + '?page=' +str(page_num+1))
            print(pages[-1])
    for page in pages:
        ximalaya_download_page(page, output_dir=output_dir, info_only=info_only, stream_id=stream_id)

View on GitHub (pinned to 049548f3f3)

Solutions

  1. Normalize the URL to http://www.ximalaya.com/<uid>/album/<id> before calling
  2. Or update the regex to r'https?://(?:www\.|m\.)?ximalaya\.com/(?:\d+/)?album/(\d+)'
  3. Prefer ximalaya_download_playlist, the public entry point, which handles paging on top of the same pattern

Example fix

# before
if re.match(r'http://www\.ximalaya\.com/(\d+)/album/(\d+)', playlist_url):
    ...
else:
    raise NotImplementedError(playlist_url)

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

Strategy: validation

Validate before calling

import re

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

Try / catch

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

Prevention

When it happens

Trigger: Calling ximalaya_download_page with 'https://www.ximalaya.com/album/123' or 'http://m.ximalaya.com/123/album/456'; both fail re.match at src/you_get/extractors/ximalaya.py:70 and hit the else raise.

Common situations: Copying album links from browsers (https) or the mobile app; passing a single-sound URL where an album URL is required; site path redesign dropping the uid segment.

Related errors


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