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

Error in makeSummary: invalid json response body at https://www.google.com/sorry/index?continue=https://www.youtube.com/watch%3FprettyPrint%3Dfalse%26v%3D5A8UUovaSb8%26pbj%3D1&q=EgQDgW_cGKyZ9bEGIjDIbez6kcN4Ofhrrbcfy2T6brx1CtlOvEP6CvOF0rtGbElS0CP3ISqeUAkwFsUF2MgyAXJaAUM reason: Unexpected token '<', "<!DOCTYPE "... is not valid JSON #97

Closed
jenny4711 opened this issue May 9, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@jenny4711
Copy link

Describe the bug
Error in makeSummary: invalid json response body at https://www.google.com/sorry/index?continue=https://www.youtube.com/watch%3FprettyPrint%3Dfalse%26v%3D5A8UUovaSb8%26pbj%3D1&q=EgQDgW_cGKyZ9bEGIjDIbez6kcN4Ofhrrbcfy2T6brx1CtlOvEP6CvOF0rtGbElS0CP3ISqeUAkwFsUF2MgyAXJaAUM reason: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

Until a few days ago, it was working fine, but since 4-5 days ago, this error has been coming up. If you remove youtubei, that error does not appear. However, because I need a transcript, I have to use youtubei, so I am reporting this issue.
my function
const youtube = new Client();
async function makeSummary(req,res){
const { videoId, lang, ask, email } = req.body;
.....
const transcript = await youtube.getVideoTranscript(videoId);
console.log(transcript,'transcript')

}
result
Error in makeSummary: invalid json response body at https://www.google.com/sorry/index?continue=https://www.youtube.com/watch%3FprettyPrint%3Dfalse%26v%3D5A8UUovaSb8%26pbj%3D1&q=EgQDgW_cGKyZ9bEGIjDIbez6kcN4Ofhrrbcfy2T6brx1CtlOvEP6CvOF0rtGbElS0CP3ISqeUAkwFsUF2MgyAXJaAUM reason: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

@jenny4711 jenny4711 added the bug Something isn't working label May 9, 2024
@SuspiciousLookingOwl
Copy link
Owner

This works fine on my end

const client = new Client();
const transcript = await client.getVideoTranscript("5A8UUovaSb8");
console.log(transcript);

It seems like your error is caused by YouTube detecting your IP as malicious (can be caused by sending too many requests with the same IP, using a VPN, or other stuff). Unfortunately, there's nothing I can do (of which I'm aware) to work around this.

@jacksonh
Copy link

I'm getting this on all requests now too. I wonder if Google recently deployed something for this.

@jacksonh
Copy link

I'm getting this on all requests now too. I wonder if Google recently deployed something for this.

> await client.getVideoTranscript("5A8UUovaSb8"); 
Uncaught:
[FetchError: invalid json response body at https://www.youtube.com/api/timedtext?v=5A8UUovaSb8&ei=sIFDZq6xFOy52roPnd2MkAc&caps=asr&opi=112496729&exp=xbt&xoaf=5&hl=en-GB&ip=0.0.0.0&ipbits=0&expire=1715725344&sparams=ip%2Cipbits%2Cexpire%2Cv%2Cei%2Ccaps%2Copi%2Cexp%2Cxoaf&signature=CA50B3C8AC657AF47C19E376E92F4A3223DFD927.604DB09FF45AD34E2CE5F96AA9BAAEB2385D5828&key=yt8&kind=asr&lang=en&prettyPrint=false&fmt=json3 reason: Unexpected token < in JSON at position 0] {
  type: 'invalid-json'
}

@SuspiciousLookingOwl
Copy link
Owner

I'm going to close this since there's not much I can do to solve this issue, however, you can try using OAuth: #113 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants