From 254aa538a5fb4422721743b1e78680c31b00741d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Wed, 24 Mar 2021 20:02:19 +0100 Subject: [PATCH] YT: fix expire calc for long movies Do not multiply video length when calculating expiration date. Otherwise for very long movies we might end up with with a past date. --- src/youtube.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/youtube.js b/src/youtube.js index ad661864..588a471d 100644 --- a/src/youtube.js +++ b/src/youtube.js @@ -227,11 +227,10 @@ var YouTubeClient = GObject.registerClass({ if(!isFoundInTemp) { const exp = info.streamingData.expiresInSeconds || 0; - const len = info.videoDetails.lengthSeconds || 3; + const dateSeconds = Math.floor(Date.now() / 1000); /* Estimated safe time for rewatching video */ - info.streamingData.expireDate = Math.floor(Date.now() / 1000) - + Number(exp) - (3 * len); + info.streamingData.expireDate = dateSeconds + Number(exp); this._createSubdirFileAsync( 'tmp', 'yt-info', videoId, JSON.stringify(info)