fish2018/pansou · info

unsupported share link

Error message

unsupported share link: %s

What it means

The extracted share link is classified via util.GetLinkType; only known pan providers (e.g. quark/uc/baidu/aliyun) are supported. If the link classifies as "others" or an empty type, the plugin cannot handle it and returns this error naming the offending URL.

Solutions

  1. Inspect the logged linkURL and, if it is a valid new pan provider, add its domain to util.GetLinkType's recognized hosts
  2. Skip/filter unsupported link types at the caller so these items are silently omitted
  3. Sanitize the extracted URL (strip tracking redirects) before classification
  4. Update GetLinkType when a provider changes its domain

Example fix

// before
if linkType == "others" || linkType == "" {
    return model.SearchResult{}, fmt.Errorf("unsupported share link: %s", linkURL)
}
// after
if linkType == "others" || linkType == "" {
    debugLog("skipping unsupported share link: %s", linkURL)
    return model.SearchResult{}, ErrUnsupportedLink // caller skips item
}
Defensive patterns

Strategy: validation

Validate before calling

linkType := util.GetLinkType(linkURL)
if linkType == "" || linkType == "others" {
    skipItem(linkURL) // filter before calling the plugin
}

Type guard

func isSupportedLink(linkType string) bool { return linkType != "" && linkType != "others" }

Try / catch

res, err := fetchPansoDocument(...)
if err != nil && strings.HasPrefix(err.Error(), "unsupported share link") {
    continue // skip unsupported provider
}

Prevention

When it happens

Trigger: linkURL points to a pan provider util.GetLinkType does not recognize (returns "others"), or linkURL is non-empty but produces an empty link type.

Common situations: Search results include links to lesser-known cloud drives, magnet/torrent pages, or ad/redirect URLs; GetLinkType's known-host list is outdated after a provider changes domain.

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.

Related errors


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

Appendix: source

Thrown at plugin/sousou/sousou.go:269

	resp, err := client.Do(req)
	if err != nil {
		return model.SearchResult{}, err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return model.SearchResult{}, fmt.Errorf("document returned status %d", resp.StatusCode)
	}
	doc, err := goquery.NewDocumentFromReader(resp.Body)
	if err != nil {
		return model.SearchResult{}, err
	}
	linkURL := strings.TrimSpace(doc.Find("a.jump-link[href]").First().AttrOr("href", ""))
	if linkURL == "" {
		return model.SearchResult{}, fmt.Errorf("document has no share link")
	}
	linkType := util.GetLinkType(linkURL)
	if linkType == "others" || linkType == "" {
		return model.SearchResult{}, fmt.Errorf("unsupported share link: %s", linkURL)
	}
	title := cleanPansoTitle(doc.Find(".resource-box h1").First().Text())
	if title == "" {
		title = cleanPansoTitle(item.Title)
	}
	datetime := item.Datetime
	if value := strings.TrimSpace(doc.Find(".description-label").FilterFunction(func(_ int, s *goquery.Selection) bool {
		return strings.TrimSpace(s.Text()) == "分享时间"
	}).Next().Text()); value != "" {
		if parsed, err := time.Parse("2006-01-02", value); err == nil {
			datetime = parsed
		}
	}
	if datetime.IsZero() {
		datetime = time.Now()
	}
	password := item.Password
	if password == "" {

View on GitHub (pinned to beaa561337)