Fix for 410 on community restricted videos #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Community age restricted videos on Youtube (the ones that require clicking the "I understand and wish to proceed" button before watching) were causing the module to throw a 410 when trying a
getInfo
Cause
getInfo
runs through a maximum of 3 urls until it has enough metadata (as defined in the validate function on info.js:59). Often we can get enough data from the first url (the basic watch page) to satisfy this and exit early, unfortunately no formats are made available when a video requires the user to click that age restricted button. The other URLs are visited and the last one in the list (youtube.com/get_video_info
) throws a 410 Gone, causing the module to also throw.Solution
Appending
&bpctr=9999999999&has_verified=1
to the first url (the basic watch page) seems to bypass that "I understand and wish to proceed" button and makes the format/stream data available right away, thus eliminating the need to visit the other URLs and never calling out to theyoutube.com/get_video_info
urlRelated
I didn't discover this, I simply ran into the problem and was searching for solutions. There have been conversations on this repo in issues and PRs about this (fent#1009 and fent#1010) but they've been closed/dismissed as being fixed under fent#1022. This does not seem to be the case for me (and at least a few other users).
Here's a video I've been using to test with https://www.youtube.com/watch?v=lwVhz0QCFEY (you can also see here that adding &bpctr=9999999999&has_verified=1 to the end of that URL gets rid of the prompt and starts playing immediately.
Code can be tested with the following test function