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.
This commit is contained in:
Rafał Dzięgiel
2021-03-24 20:02:19 +01:00
parent 58cc45ec7d
commit 254aa538a5

View File

@@ -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)