nilaoda/N_m3u8DL-RE · error · NotSupportedException

ResString.notSupported

Error message

ResString.notSupported

What it means

LoadSourceFromText sniffs the downloaded source text to pick a stream extractor (M3U8, DASH, TS, etc.). If the text is identified as raw binary data (rawText == ResString.ReBinaryData), there is no text-based parser that can handle it, so it throws NotSupportedException(ResString.notSupported). A second generic branch throws the same for any unrecognized content.

Solutions

  1. Pass the playlist/manifest URL (m3u8/mpd), not the media segment URL.
  2. Check whether the response is gzip/br compressed and decompress before parsing.
  3. If the content is a raw TS stream, ensure the input is treated as a live TS source rather than text.
  4. Inspect the first bytes of the response to identify the actual content type.
  5. Catch NotSupportedException and fall back to a different extraction mode (e.g. treat as raw binary download).

Example fix

// before
await extractor.LoadSourceFromUrlAsync(mediaUrl); // media segment URL
// after
await extractor.LoadSourceFromUrlAsync(playlistUrl); // pass the m3u8/mpd manifest URL
Defensive patterns

Strategy: validation

Validate before calling

// only pass manifest URLs; verify the body looks like a text manifest first
var head = (await DownloadHeadAsync(url, 512));
bool isManifest = head.Contains("#EXTM3U") || head.Contains("<MPD") || head.Contains("#EXT-X");
if (!isManifest) throw new InvalidOperationException($"{url} does not look like an m3u8/mpd manifest");

Try / catch

try { await extractor.LoadSourceFromUrlAsync(url); }
catch (NotSupportedException ex) when (ex.Message == ResString.notSupported) {
    logger.Error($"Source at {url} is binary/unsupported content; pass the manifest URL instead");
}

Prevention

When it happens

Trigger: LoadSourceFromUrlAsync downloads content whose body is binary (not a recognizable text playlist), or content matching none of the known formats, and LoadSourceFromText falls through to the binary-data or else branch.

Common situations: URL points to an actual media file (.ts/.mp4) instead of a playlist; server returns a gzip/binary blob the downloader did not decompress; content is encrypted/DRM-wrapped; URL serves a login or CAPTCHA page that is misdetected.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.


AI-assisted analysis of nilaoda/N_m3u8DL-RE@e113dee70c (2026-09-13). Data as JSON: /api/errors/913cc8e743c83dc5. Report an issue: GitHub.

Appendix: source

Thrown at src/N_m3u8DL-RE.Parser/StreamExtractor.cs:93

            extractor = new DASHExtractor2(parserConfig);
            rawType = "mpd";
        }
        else if (rawText.Contains("</SmoothStreamingMedia>") && rawText.Contains("<SmoothStreamingMedia"))
        {
            Logger.InfoMarkUp(ResString.matchMSS);
            // extractor = new DASHExtractor(parserConfig);
            extractor = new MSSExtractor(parserConfig);
            rawType = "ism";
        }
        else if (rawText == ResString.ReLiveTs)
        {
            Logger.InfoMarkUp(ResString.matchTS);
            extractor = new LiveTSExtractor(parserConfig);
        }
        else if (rawText == ResString.ReBinaryData)
        {
            Logger.InfoMarkUp(ResString.matchBinaryData);
            throw new NotSupportedException(ResString.notSupported);
        }
        else
        {
            throw new NotSupportedException(ResString.notSupported);
        }

        RawFiles[$"raw.{rawType}"] = rawText;
    }

    /// <summary>
    /// 开始解析流媒体信息
    /// </summary>
    /// <returns></returns>
    public async Task<List<StreamSpec>> ExtractStreamsAsync()
    {
        try
        {
            await semaphore.WaitAsync();

View on GitHub (pinned to e113dee70c)