youtube icon indicating copy to clipboard operation
youtube copied to clipboard

cannot parse JSON

Open DeadNumbers opened this issue 4 years ago • 2 comments

panic: got malformed json searching for page 0 of query "animus vox": cannot parse JSON: cannot parse empty string; unparsed tail: ""

DeadNumbers avatar Sep 21 '20 06:09 DeadNumbers

I got the same when using the example, perhaps the library no longer works?

LordRusk avatar Nov 17 '20 04:11 LordRusk

@lithdew I believe the issue is that we are querying https://www.youtube.com/search_ajax?, but the required headers have not been set. The following headers must be sent in the request: x-youtube-client-name: 56 x-youtube-client-version: 20200911

This is easily tested using Postman. When one or both headers are not included, the response is empty. If both headers are included, the response contains search results as we would expect. Here's a screenshot: image

I would submit a fix for this myself, but I see that you're using your own http library to perform the request and I'm not at all familiar with how it works. I imagine this should be pretty simple, however.

cofonseca avatar Dec 01 '20 19:12 cofonseca