ytdl-org/youtube-dl · error · ExtractorError

Unknown function %s

Error message

Unknown function %s

What it means

Raised by IqiyiSDKInterpreter.run when the server-delivered, packer-obfuscated auth SDK code references a function name that the interpreter's dispatch table does not know. The interpreter only implements mod<NN>, date[ymd]{3}, split<NN> and seven named helpers (handleSum, handleInput8/16, splitTimeEvenOdd/OddEven, splitIpTimeSum, splitTimeIpSum); anything else is fatal.

Source

Thrown at youtube_dl/extractor/iqiyi.py:153

            'handleSum': sdk.handleSum,
            'handleInput8': sdk.handle_input8,
            'handleInput16': sdk.handle_input16,
            'splitTimeEvenOdd': sdk.split_time_even_odd,
            'splitTimeOddEven': sdk.split_time_odd_even,
            'splitIpTimeSum': sdk.split_ip_time_sum,
            'splitTimeIpSum': sdk.split_time_ip_sum,
        }
        for function in functions:
            if re.match(r'mod\d+', function):
                sdk.mod(int(function[3:]))
            elif re.match(r'date[ymd]{3}', function):
                sdk.date(function[4:])
            elif re.match(r'split\d+', function):
                sdk.split(int(function[5:]))
            elif function in other_functions:
                other_functions[function]()
            else:
                raise ExtractorError('Unknown function %s' % function)

        return sdk.target


class IqiyiIE(InfoExtractor):
    IE_NAME = 'iqiyi'
    IE_DESC = '爱奇艺'

    _VALID_URL = r'https?://(?:(?:[^.]+\.)?iqiyi\.com|www\.pps\.tv)/.+\.html'

    _NETRC_MACHINE = 'iqiyi'

    _TESTS = [{
        'url': 'http://www.iqiyi.com/v_19rrojlavg.html',
        # MD5 checksum differs on my machine and Travis CI
        'info_dict': {
            'id': '9c1fb1b99d192b21c559e5a1a2cb3c73',
            'ext': 'mp4',

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Update youtube-dl (or switch to yt-dlp) - iQiyi's SDK changes are handled by extractor updates.
  2. If maintaining a fork, decode the new sdk_code (decode_packed_codes) and implement the missing function in IqiyiSDK, then register it in other_functions.
  3. Retry later; iQiyi sometimes serves different SDK variants per region/CDN.

Example fix

// before (extractor internals): server SDK calls e.g. 'handleInput32(input)
raise ExtractorError('Unknown function %s' % function)

// after: implement and register the new helper in IqiyiSDK + other_functions
other_functions = {
    ...
    'handleInput32': sdk.handle_input32,
}
Defensive patterns

Strategy: fallback

Try / catch

try:
    ydl.extract_info(iqiyi_url)
except ExtractorError as e:
    if str(e).startswith('Unknown function '):
        # extractor/SDK drift: switch tool, do not retry with same version
        run_via_yt_dlp(iqiyi_url)

Prevention

When it happens

Trigger: iQiyi ships an updated player SDK whose 'input=FN(input)' calls include a new or renamed hashing/mixing function; the extractor's re.findall on the decoded SDK code surfaces that unknown name and the loop hits the else branch.

Common situations: iQiyi rotates its anti-scraping signature algorithm; an old youtube-dl build then fails on every iQiyi URL with 'Unknown function ...'. Almost always a stale-extractor symptom, not a per-URL problem.

Related errors


AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14). Data as JSON: /api/errors/14f82fc7620b2d15. Report an issue: GitHub.