Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

fix: address reelPlayerHeaderRenderer when undefined #189

Merged
merged 4 commits into from
Apr 14, 2023

Conversation

reply2za
Copy link
Contributor

@reply2za reply2za commented Mar 29, 2023

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
Copy link
Contributor Author

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
Copy link
Owner

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
Copy link
Contributor Author

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

3tb3rfn1uk-1680185805611.txt

5eo04z4td4-1680185805608.txt

@reply2za
Copy link
Contributor Author

reply2za commented Mar 31, 2023

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 TimeForANinja merged commit d03b4c2 into TimeForANinja:master Apr 14, 2023
@TimeForANinja
Copy link
Owner

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
Copy link

🎉 This PR is included in version 3.8.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants