Skip to content

Commit

Permalink
fix: fix race condition causing multiple watch page requests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fent committed Nov 14, 2020
1 parent 60cdb41 commit 6ec1242
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/info.js
Expand Up @@ -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());
Expand Down

0 comments on commit 6ec1242

Please sign in to comment.