commit 2155234e871fd4be0a4e5b994ba18a7a6f68576f
parent 5b3fb77b0634e03f43a5409ac96ded4cdf701e6d
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 24 Sep 2026 22:29:14 -0400
common: slice R review — best-effort sweep cooldown write, truthful incomplete line, probe args without config
The incomplete-sweep branch records the cooldown in the same best-effort
try/catch the download path uses (a failed state write logs a warning and the
paged walk still runs). The log line now says what happens next: syncs wait
for the platform cooldown, then the sweep is retried. The enumeration comment
is back above enumeratePlaylistUrls. checkAvailability adds
platformArgs(detectPlatform(url)) when the channel has no config.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/common/controller/checkAvailability.ts b/common/controller/checkAvailability.ts
@@ -25,7 +25,8 @@ import { getSettings } from "../lib/settings";
// digest registry's claude-code lane, which has the same problem.
import { parseStdoutJson } from "../lib/parseStdoutJson";
import { readChannelConfig } from "./channels";
-import { channelExtraArgs } from "../ytdlp/channelArgs";
+import { channelExtraArgs, platformArgs } from "../ytdlp/channelArgs";
+import { detectPlatform } from "../lib/platform";
import { resolveShardItems } from "./shard";
import type { Paths } from "../lib/paths";
@@ -216,7 +217,10 @@ export async function runAvailabilityCheck({
"--no-warnings",
...(config
? channelExtraArgs(config, probeCookies)
- : cookieArgs(probeCookies)),
+ : [
+ ...cookieArgs(probeCookies),
+ ...platformArgs(detectPlatform(url)),
+ ]),
"--",
url,
];
diff --git a/common/ytdlp/runYtdlp.ts b/common/ytdlp/runYtdlp.ts
@@ -313,9 +313,8 @@ export function outputArgsForUrl(
return OUTPUT_ARGS;
}
-// Enumerate a channel's video URLs via `--flat-playlist --print url` (metadata
-// only, no downloads). Pass `range` to fetch a single newest-first page via
-// `-I start:end`; sync uses this to walk the channel incrementally.
+// Thrown by enumeratePlaylistUrls when a listing is rate-limited part-way.
+//
// A full enumeration that the platform rate-limited part-way through. What it
// printed is a PREFIX of the listing, not a listing: acting on it as one would
// flag every entry past the cut-off as missing, and failing the sync on it
@@ -366,6 +365,9 @@ function cooldownPlatformKey(config: ChannelConfig): string {
return detectPlatform(config.url) ?? "unknown";
}
+// Enumerate a channel's video URLs via `--flat-playlist --print url` (metadata
+// only, no downloads). Pass `range` to fetch a single newest-first page via
+// `-I start:end`; sync uses this to walk the channel incrementally.
async function enumeratePlaylistUrls(
opts: RunYtdlpOpts,
root: string,
@@ -1636,11 +1638,21 @@ async function syncFullSweep(opts: RunYtdlpOpts): Promise<void> {
// listing, so it never reaches acceptEnumeration (no playlist rewrite, no
// missing set, no lastFullSweepAt). Record the platform's cooldown the way
// a download's 429 does, then do this sync's job the cheap way.
- await opts.onPlatformBackoff?.("rate_limit");
+ // Best-effort, as on the download path: a failed state write must not fail
+ // the sync this branch exists to rescue.
+ try {
+ await opts.onPlatformBackoff?.("rate_limit");
+ } catch (backoffErr) {
+ opts.onLog(
+ `Warning: could not record the ${err.platform} cooldown (${
+ backoffErr instanceof Error ? backoffErr.message : String(backoffErr)
+ }); continuing.\n`,
+ );
+ }
opts.onLog(
`Full sweep incomplete: 429 at ${
err.pagesReached !== null ? `page ${err.pagesReached}` : "an unknown page"
- } of the listing, ${err.count} entries — not a listing; next syncs are paged walks until the ${err.platform} cooldown ends.\n`,
+ } of the listing, ${err.count} entries — not a listing. Ran the paged walk instead; syncs wait for the ${err.platform} cooldown, then the sweep is retried.\n`,
);
if (opts.signal.aborted) return;
return syncPaged(opts);