feat(network): request-throttle controls to avoid YouTube rate-limiting

Re-implements the sleepRequests/sleepInterval/maxSleepInterval feature
(--sleep-requests / --sleep-interval / --max-sleep-interval) from the
stale feat/binary-management-and-library-scale branch, ported onto
current main's structure (zod settingsSchema, decomposed NetworkCard).
All default to 0/off, preserving current behaviour.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 16:34:34 -04:00
parent 61d5261e33
commit 5c88d9c8e0
7 changed files with 146 additions and 0 deletions
+17
View File
@@ -615,6 +615,20 @@ export interface Settings {
proxy: string
/** yt-dlp --limit-rate value, e.g. '2M' or '500K'. Empty means unlimited. */
rateLimit: string
/**
* Request throttle (seconds), to avoid YouTube's "rate-limited for up to an
* hour" / HTTP 403 wall when pulling a whole channel. All default to 0 = off
* (yt-dlp's as-fast-as-possible behaviour):
* - sleepRequests: `--sleep-requests`, a pause between the metadata/extraction
* HTTP requests — the single most effective knob for large channel pulls.
* - sleepInterval / maxSleepInterval: `--sleep-interval` (min) and
* `--max-sleep-interval` (max) bracket a random pause before each download.
* max only applies when it's set above a non-zero min (yt-dlp requires the
* min to be present, and a max below it is meaningless).
*/
sleepRequests: number
sleepInterval: number
maxSleepInterval: number
/** use bundled aria2c (resources/bin/aria2c.exe) as the external downloader */
useAria2c: boolean
/** aria2c parallel connections per download (-x/-s), 116; only used when useAria2c is on (L64) */
@@ -709,6 +723,9 @@ export const DEFAULT_SETTINGS: Settings = {
downloadOptions: DEFAULT_DOWNLOAD_OPTIONS,
proxy: '',
rateLimit: '',
sleepRequests: 0,
sleepInterval: 0,
maxSleepInterval: 0,
useAria2c: false,
aria2cConnections: 16,
cookieSource: 'none',