This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
fix: address filterWrapper is not iterable error #210
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses issue#206
A quick and technically not ideal fix. This change adds a safety check so that if
wrapper.subMenu
returns undefined, then the method returns an empty filter map, instead of throwing an error. This will likely always be the case now and this code does not address the root issue.The fact of the matter is that YouTube likely updated their payload data (thus breaking the filter feature). The main fix would be updating the path to
searchFilterGroupRenderer
, which still exists. The point of this PR, at the very least, is to add a safety check to allow for YTSR to return search data, which is much better than not returning anything at all whenever YouTube updates their response.Furthermore, I did take a look into the new payload and found that filter data could maybe be retrieved like this:
I did not make a PR with this code (yet) for a few reasons.
Firstly because all the tests that rely on local HTML data fail, because this code only expects the new payload format. Also the typings have to be updated.Update:
I updated the code to support both the old and new payload formats.
Thanks,
Reply2za