diff options
author | Ajay Ramachandran <[email protected]> | 2021-08-20 18:56:08 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2021-08-20 18:56:08 -0400 |
commit | 50d5f956c6aa3efbaf2dd134d9f5224431b0bca4 (patch) | |
tree | 831ec9f5186ebf80f91a64a251d2ae27e22a9166 | |
parent | 585038c902734425d5ebf1dd9669822be11a0879 (diff) | |
download | SponsorBlock-50d5f956c6aa3efbaf2dd134d9f5224431b0bca4.tar.gz SponsorBlock-50d5f956c6aa3efbaf2dd134d9f5224431b0bca4.zip |
Refetch when not found no matter the date
-rw-r--r-- | src/content.ts | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/content.ts b/src/content.ts index b9921a9c..b6e7f8db 100644 --- a/src/content.ts +++ b/src/content.ts @@ -286,7 +286,7 @@ async function videoIDChange(id) { } // Get new video info - getVideoInfo(); + // getVideoInfo(); // Seems to have been replaced // Update whitelist data when the video data is loaded whitelistCheck(); @@ -726,20 +726,11 @@ function retryFetch(): void { sponsorDataFound = false; - //check if this video was uploaded recently - utils.wait(() => !!videoInfo).then(() => { - const dateUploaded = videoInfo?.microformat?.playerMicroformatRenderer?.uploadDate; - console.log(dateUploaded) - - //if less than 3 days old - if (Date.now() - new Date(dateUploaded).getTime() < 259200000) { - setTimeout(() => { - if (sponsorVideoID && sponsorTimes?.length === 0) { - sponsorsLookup(sponsorVideoID); - } - }, 10000 + Math.random() * 30000); + setTimeout(() => { + if (sponsorVideoID && sponsorTimes?.length === 0) { + sponsorsLookup(sponsorVideoID); } - }); + }, 10000 + Math.random() * 30000); sponsorLookupRetries = 0; } @@ -801,6 +792,8 @@ function startSkipScheduleCheckingForStartSponsors() { /** * Get the video info for the current tab from YouTube + * + * TODO: Replace */ async function getVideoInfo(): Promise<void> { const result = await utils.asyncRequestToCustomServer("GET", "https://www.youtube.com/get_video_info?video_id=" + sponsorVideoID + "&html5=1&c=TVHTML5&cver=7.20190319"); |