Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for 410 on community restricted videos #1

Merged
merged 1 commit into from
Mar 26, 2022

Conversation

JackReevies
Copy link
Owner

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 the youtube.com/get_video_info url

Related

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

async function start() {
	  try { 
	  	const info = await getInfo('lwVhz0QCFEY') 
	  } catch(e) {
	    console.error(e)
	  }
}

@JackReevies JackReevies merged commit 71480bd into master Mar 26, 2022
@JackReevies JackReevies deleted the fix-watch-page-410-community-restricted-videos branch March 26, 2022 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant