From 6ec12421cd9eef36937cbf941f727acb78f70830 Mon Sep 17 00:00:00 2001 From: fent <933490+fent@users.noreply.github.com> Date: Fri, 13 Nov 2020 01:34:53 -0700 Subject: [PATCH] fix: fix race condition causing multiple watch page requests this was happening due to the `bpctr` param added to bypass the "offensive video" warning. if the `getInfo()` process took longer than a second, it would make another request. the `bpctr` param is now removed since it no longer seems to be needed. if you find a video that still shows a warning, let me know. --- lib/info.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/info.js b/lib/info.js index ace319c5..ddb78dea 100644 --- a/lib/info.js +++ b/lib/info.js @@ -103,8 +103,7 @@ const isRental = player_response => { }; -const getWatchURL = (id, options) => - `${VIDEO_URL + id}&hl=${options.lang || 'en'}&bpctr=${Math.ceil(Date.now() / 1000)}`; +const getWatchURL = (id, options) => `${VIDEO_URL + id}&hl=${options.lang || 'en'}`; const getWatchPage = (id, options) => { const url = getWatchURL(id, options); return exports.watchPageCache.getOrSet(url, () => miniget(url, options.requestOptions).text());