fish2018/pansou · warning

不支持的网盘类型 root= id=

Error message

不支持的网盘类型 root=%d id=%d

What it means

This error is returned by YingsoPlugin.resolveItem when the netdisk type of a search item — the numeric Root field — does not map to any supported provider in buildLink (only roots 1-5: aliyun, quark, xunlei, baidu, uc), or the constructed share URL fails URL validation. The key was fetched successfully, but the plugin cannot build a link for that cloud-drive type.

Solutions

  1. Log item.Root and item.ID, then check buildLink's switch statement: add a case mapping the new root value to the correct type and URL prefix (yingso.go:368-389).
  2. If the API added a new netdisk provider, extend buildLink with the new prefix (e.g. case 6 for a new drive) and rebuild.
  3. If Root=0 means 'unknown', filter such items out in search() before spawning resolveItem goroutines to avoid wasted getKey calls.
  4. If the key string is malformed (URL validation fails), log the raw response.Data to inspect what the API returns and adjust parsing.

Example fix

// before
case 5:
	linkType, prefix = "uc", "https://drive.uc.cn/s/"
default:
	return "", "", ""
// after
case 5:
	linkType, prefix = "uc", "https://drive.uc.cn/s/"
case 6:
	linkType, prefix = "quark-share", "https://pan.quark.cn/s/"
default:
	return "", "", ""
Defensive patterns

Strategy: validation

Validate before calling

func isSupportedRoot(root int) bool {
	switch root {
	case 1, 2, 3, 4, 5:
		return true
	}
	return false
}
// filter before resolving:
items = slices.DeleteFunc(items, func(it searchItem) bool { return !isSupportedRoot(it.Root) })

Type guard

func knownRoot(root int) bool { return root >= 1 && root <= 5 }

Try / catch

result, err := resolveItem(ctx, client, config, item)
if err != nil {
	if strings.Contains(err.Error(), "不支持的网盘类型") {
		log.Printf("unsupported drive type, skipping id=%v", err)
		return nil
	}
	return err
}

Prevention

When it happens

Trigger: getKey succeeded (data non-empty) but item.Root is 0 or any value outside {1,2,3,4,5}, causing buildLink's default branch to return an empty linkURL; alternatively the returned key yields a URL that fails url.Parse / scheme-host validation in buildLink.

Common situations: The Yingso API added support for a new cloud-drive provider (new Root value) that this plugin version does not know; items with Root=0 (unknown type) appear in search results; the API returns a malformed or relative key string instead of a share ID/URL.

Related errors


AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07). Data as JSON: /api/errors/ccff0cd6f0b3dea0. Report an issue: GitHub.

Appendix: source

Thrown at plugin/yingso/yingso.go:253

func (p *YingsoPlugin) resolveItem(ctx context.Context, client *http.Client, config apiConfig, item searchItem) (model.SearchResult, error) {
	payload := getKeyPayload{ID: item.ID, UserID: config.UserID}
	encrypted, err := encryptPayload(payload, config)
	if err != nil {
		return model.SearchResult{}, err
	}

	var response apiEnvelope[string]
	endpoint := fmt.Sprintf("%s/%s/getKey", p.apiBaseURL, url.PathEscape(config.URLVersion))
	if err := p.requestJSON(ctx, client, http.MethodPost, endpoint, encrypted, &response); err != nil {
		return model.SearchResult{}, err
	}
	if response.Code != http.StatusOK || strings.TrimSpace(response.Data) == "" {
		return model.SearchResult{}, fmt.Errorf("getKey id=%d code=%d msg=%s", item.ID, response.Code, response.Msg)
	}

	linkType, linkURL, password := buildLink(item.Root, response.Data)
	if linkURL == "" {
		return model.SearchResult{}, fmt.Errorf("不支持的网盘类型 root=%d id=%d", item.Root, item.ID)
	}

	title := cleanText(item.Title)
	if title == "" {
		title = fmt.Sprintf("影搜资源 %d", item.ID)
	}
	id := fmt.Sprintf("%s-%d", pluginName, item.ID)
	now := time.Now()
	return model.SearchResult{
		MessageID: id,
		UniqueID:  id,
		Channel:   "",
		Datetime:  now,
		Title:     title,
		Content:   title,
		Links: []model.Link{{
			Type:      linkType,
			URL:       linkURL,

View on GitHub (pinned to beaa561337)