feat(youtube): map caption 429 to SourceRateLimited
The baseUrl fetch mapped every non-200 to SourceNone, recording a 429 as a permanent "no captions". 429 is the IP being rate-limited, not an absent transcript. Return SourceRateLimited (still a graceful degrade, no error) so the runner can retry after a backoff window. Other non-200s (403/404/5xx) stay SourceNone. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,12 @@ func (a *Adapter) FetchTranscript(ctx context.Context, v domain.Video) (domain.T
|
||||
if err != nil {
|
||||
return domain.Transcript{}, fmt.Errorf("download caption track for %q: %w", v.ProviderVideoID, err)
|
||||
}
|
||||
if status == http.StatusTooManyRequests {
|
||||
// 429 means the IP is rate-limited; record for retry, not a permanent
|
||||
// absence. Degrade gracefully (no error, no text) like SourceNone, but
|
||||
// flag it distinctly so the runner backs off and retries (ADR-007/010).
|
||||
return domain.Transcript{VideoID: v.ID, UserID: v.UserID, Source: domain.SourceRateLimited}, nil
|
||||
}
|
||||
if status != http.StatusOK {
|
||||
// Owner-only 403, region/age gate, or transient unavailability: not an error.
|
||||
return noTranscript(v), nil
|
||||
|
||||
Reference in New Issue
Block a user