From 0057ad416a4ff1a0a54812e784eb4eb26386d08e Mon Sep 17 00:00:00 2001 From: Marvin Alexander Krebber Date: Sun, 27 Oct 2024 13:20:03 +0100 Subject: [PATCH] first fix Amazon.com ad --- AuthorHours.json | 2 +- firefox/skipper.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/AuthorHours.json b/AuthorHours.json index 84854dcb..dabf8851 100644 --- a/AuthorHours.json +++ b/AuthorHours.json @@ -1 +1 @@ -{"time":"480h16m32s"} \ No newline at end of file +{"time":"480h34m56s"} \ No newline at end of file diff --git a/firefox/skipper.js b/firefox/skipper.js index 4b6e8404..3df0f8f6 100644 --- a/firefox/skipper.js +++ b/firefox/skipper.js @@ -1097,7 +1097,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO async function skipAd(video) { // Series grimm const adTimeText = document.querySelector(".atvwebplayersdk-ad-timer-text"); - if (adTimeText) { + if (adTimeText?.checkVisibility()) { let adTime; adTime = parseAdTime(adTimeText?.childNodes?.[0]?.textContent); if (!adTime) adTime = parseAdTime(adTimeText?.childNodes?.[1]?.textContent); @@ -1105,7 +1105,9 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO if (!document.querySelector(".fu4rd6c.f1cw2swo") && adTime > 1 && !lastAdTimeText) { lastAdTimeText = adTime; resetLastATimeText(); - const skipTime = adTime - 1; + // biggest skiptime before crashing on amazon.com, can be little higher than 90 but 90 to be safe + const bigTime = 90; + const skipTime = adTime > bigTime ? bigTime : adTime - 1; video.currentTime += skipTime; log("FreeVee Ad skipped, length:", skipTime, "s"); settings.Statistics.AmazonAdTimeSkipped += skipTime;