fix(Playlist): trying to parse an already parsed response #286
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.
Description
I saw this issue in FreeTubeApp/FreeTube#3046 and figured I'd take a crack at it. It would seem that InnerTube has some trouble loading the last videos of long playlists (perhaps because they can only load in batches of 100 videos and never less than that?).
Since the library never expects
on_load_received_actions
to be undefined when doing pagination, it thinks the response is not parsed and tries to parse it, inevitably ending up in aInnertubeError: Type not found!
which is then followed byInnertubeError: This playlist does not exist
when retrieving the last page of a long playlist. It says “Type not found” because it's trying to runParser#parseResponse
on the parsed data all over again. To fix this, I explicitly setalready_parsed
totrue
inPlaylist#getContinuation()
and added amessages
prop toPlaylist
(which in this case obviously returnsUnavailable videos are hidden
andNo videos in this playlist yet
when YouTube can't return more playlist items).Code I used to test this:
Output:
Note that 100 * 18 = 1800 which is roughly the size of the playlist used.
Type of change
Please delete options that are not relevant.
Checklist: