TimeForANinja / node-ytsr

Do anonymous YouTube search requests.
MIT License
286 stars 66 forks source link

fix: address reelPlayerHeaderRenderer when undefined #189

Closed reply2za closed 1 year ago

reply2za commented 1 year ago

Node-ytsr team. This update fixes #188.

I noticed that the local tests were also throwing the same error. That is no longer the case after this fix.

closes #188 closes #191

reply2za commented 1 year ago

Didn't notice the lint issue prior to pushing. I updated the code to prevent the use of the ternary operator "?", which causes the lint error.

TimeForANinja commented 1 year ago

i have to trigger the ci/cd manually for first-time contributors

anyway, do you still have the dump-file? i don't think we should even enter the parseShort function if obj is not a short and if it is a short there informations have to be at some place, don't they?

reply2za commented 1 year ago

Sure, these are in the dump folder. I get this error with every query.

3tb3rfn1uk-1680185805611.txt

5eo04z4td4-1680185805608.txt

reply2za commented 1 year ago

anyway, do you still have the dump-file? i don't think we should even enter the parseShort function if obj is not a short and if it is a short there informations have to be at some place, don't they?

I spent quite some time trying to figure that out. These items are shorts but they are missing some objects in the payload. It appears that youtube has updated the provided data for shorts on a specific page or entry-point. You can see this for yourself with the dump files or by running your unit tests on the original branch.

The main difference is that there is no channel information, but all other information can be retrieved (although not always from the same object). I made an update to parseShort so that if we were to receive limited metadata on the short, instead of returning a undefined reference error, we can still return the short's parsed data... just without the channel info.

I also added a reelItemRenderer_01.json to the tests that covers the type of response I am seeing in my latest dump files. I also updated the expected parsed result. The new addition to the test suite runs and passes with the latest commit.

A suspicion for the different payload could be whether the reelItemRenderer comes from the reelShelfRenderer or not. That is something I may look into later.

TimeForANinja commented 1 year ago

thanks for the PR i simplified it a bit further and added some tests to prevent this from happening in the future guess it was already worth it since it found related problems in another file i also spotted that we don't have any typings yet and added them

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 3.8.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: