fish2018/pansou · error

跳转接口返回状态码

Error message

跳转接口返回状态码 %d

What it means

Guard in ting77 resolveLink: the redirect endpoint did not answer with a 3xx carrying a Location header (status <300, >=400, or empty Location). Stored as lastErr and the entry is retried/continued; the resource link cannot be obtained without the redirect.

Solutions

  1. Check whether the entry ID is still valid on the site
  2. Slow down: non-3xx here is often rate limiting or an expired session
  3. Treat persistent failure as a dead entry, not a search failure
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at plugin/ting77/ting77.go:252 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at plugin/ting77/ting77.go:252

		setRequestHeaders(req, p.baseURL+"/resource/"+entry.ID, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
		redirectClient := &http.Client{
			Timeout:   client.Timeout,
			Transport: client.Transport,
			Jar:       client.Jar,
			CheckRedirect: func(_ *http.Request, _ []*http.Request) error {
				return http.ErrUseLastResponse
			},
		}
		resp, err := redirectClient.Do(req)
		if err != nil {
			lastErr = err
			continue
		}
		io.Copy(io.Discard, io.LimitReader(resp.Body, 512<<10))
		resp.Body.Close()
		location := strings.TrimSpace(resp.Header.Get("Location"))
		if resp.StatusCode < 300 || resp.StatusCode >= 400 || location == "" {
			lastErr = fmt.Errorf("跳转接口返回状态码 %d", resp.StatusCode)
			continue
		}
		resolved, err := url.Parse(location)
		if err != nil || resolved.Scheme == "" || resolved.Host == "" {
			lastErr = fmt.Errorf("跳转接口返回无效链接")
			continue
		}
		linkType := detectLinkType(location)
		if linkType == "others" {
			lastErr = fmt.Errorf("跳转接口返回不支持的链接: %s", resolved.Host)
			continue
		}
		link := model.Link{
			Type:      linkType,
			URL:       location,
			Password:  extractPassword(location),
			Datetime:  entry.Datetime,
			WorkTitle: entry.Title,

View on GitHub (pinned to beaa561337)