fish2018/pansou · error

[susu] 按钮详情请求返回状态码

Error message

[susu] 按钮详情请求返回状态码: %d

What it means

Status error in susu's getButtonDetail (plugin/susu/susu.go:459): the button-detail API returned a non-200 status after retries, so the JWT/URL payload for this link cannot be obtained. Search-level data was fine; this per-link fetch was rejected.

Solutions

  1. Back off and rate-limit button-detail requests
  2. Check 403 vs 429 to distinguish blocking from rate limiting
  3. Verify the form fields (post_id/index/i) are still valid
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at plugin/susu/susu.go:459 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/dcf361b32594b687. Report an issue: GitHub.

Appendix: source

Thrown at plugin/susu/susu.go:459

		"guest":   {""},
	}
	ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
	defer cancel()

	req, err := http.NewRequestWithContext(ctx, http.MethodPost, ButtonDetailURL, strings.NewReader(form.Encode()))
	if err != nil {
		return model.Link{}, fmt.Errorf("[susu] 创建按钮详情请求失败: %w", err)
	}
	setAPIHeaders(req, fmt.Sprintf("%s/download?post_id=%s&index=%d&i=%d", BaseURL, postID, index, i))

	// 发送请求(带重试)
	resp, err := p.doRequestWithRetry(client, req, MaxRetries)
	if err != nil {
		return model.Link{}, fmt.Errorf("[susu] 获取按钮详情失败: %w", err)
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return model.Link{}, fmt.Errorf("[susu] 按钮详情请求返回状态码: %d", resp.StatusCode)
	}

	// 读取响应体
	respBody, err := io.ReadAll(io.LimitReader(resp.Body, 2<<20))
	if err != nil {
		return model.Link{}, fmt.Errorf("[susu] 读取按钮详情失败: %w", err)
	}

	// 解析响应
	var buttonDetail buttonDetailResponse
	if err := json.Unmarshal(respBody, &buttonDetail); err != nil {
		return model.Link{}, fmt.Errorf("[susu] 解析按钮详情失败: %w", err)
	}

	// 如果URL为空
	if buttonDetail.Button.URL == "" {
		return model.Link{}, fmt.Errorf("[susu] 按钮URL为空")
	}

View on GitHub (pinned to beaa561337)