From ec1e6d63a4d15bffbeed7dde852eba761162d6ca Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 12 Jun 2024 09:55:41 +0530 Subject: [PATCH] Add protection against server-side ad injection (SSAP) --- src/routes/postSkipSegments.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/routes/postSkipSegments.ts b/src/routes/postSkipSegments.ts index be0f5a6..217be5c 100644 --- a/src/routes/postSkipSegments.ts +++ b/src/routes/postSkipSegments.ts @@ -129,6 +129,11 @@ async function autoModerateSubmission(apiVideoDetails: videoDetails, // return false on undefined or 0 if (!duration) return false; + if (apiDuration && apiDuration > 2 && duration && duration > 2 && Math.abs(apiDuration - duration) > 3) { + // YouTube server-side ad injection might be active, reject + return "YouTube is currently testing a new anti-adblock technique called server-side ad-injection. This causes skips and submissions to be offset by the duration of the ad. It seems that you are affected by this A/B test, so until a fix is developed, we cannot accept submissions from your device due to them potentially being inaccurate."; + } + const segments = submission.segments; // map all times to float array const allSegmentTimes = segments.filter((s) => s.actionType !== ActionType.Chapter)