fish2018/pansou · warning

链接令牌请求过于频繁

Error message

链接令牌请求过于频繁

What it means

errRateLimited is ting77's sentinel error meaning the plugin hit its self-imposed token-request budget (maxTokenRequests=8 within a 65s window). resolveLink/fetchLinkToken return it when the site throttles or the budget is exhausted; resolveEntries and the worker loop break out instead of hammering the site.

Solutions

  1. Wait ~65 seconds for the token window to reset, then retry
  2. Reduce concurrency / number of entries resolved per search to stay under 8 token requests per window
  3. Increase maxTokenRequests or tokenWindow constants if the site tolerates more traffic
  4. Persist resolved tokens so repeat searches don't re-fetch links

Example fix

// before
if errors.Is(lastErr, errRateLimited) {
    break
}
// after
if errors.Is(lastErr, errRateLimited) {
    time.Sleep(tokenWindow)
    // retry resolveEntries once
    break
}
Defensive patterns

Strategy: retry

Validate before calling

// Go
if tokensUsedInWindow() >= maxTokenRequests { waitUntilWindowReset() }

Try / catch

if errors.Is(err, errRateLimited) {
    time.Sleep(tokenWindow)
    // retry once
}

Prevention

When it happens

Trigger: Requesting more than 8 link tokens within 65 seconds (e.g. resolving many entries at once); the remote ting77 site returning throttle/429 responses during token fetching.

Common situations: Bulk-searching songs with many matching entries so each resolveLink consumes budget; repeated searches within a minute; slow site responses causing retries that burn the token budget.

Related errors


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

Appendix: source

Thrown at plugin/ting77/ting77.go:33

	"github.com/PuerkitoBio/goquery"
	"pansou/model"
	"pansou/plugin"
	"pansou/util/json"
)

const (
	pluginName       = "ting77"
	pluginPriority   = 2
	defaultBaseURL   = "https://sou.77ting.top"
	requestTimeout   = 25 * time.Second
	maxResponseBytes = 4 << 20
	maxTokenRequests = 8
	tokenWindow      = 65 * time.Second
	browserUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
)

var errRateLimited = errors.New("链接令牌请求过于频繁")

func init() {
	plugin.RegisterGlobalPlugin(NewTing77Plugin())
}

type Ting77Plugin struct {
	*plugin.BaseAsyncPlugin
	baseURL      string
	linkCache    sync.Map
	tokenMu      sync.Mutex
	tokenRequest []time.Time
}

func NewTing77Plugin() *Ting77Plugin {
	return &Ting77Plugin{
		BaseAsyncPlugin: plugin.NewBaseAsyncPlugin(pluginName, pluginPriority),
		baseURL:         defaultBaseURL,
	}

View on GitHub (pinned to beaa561337)