This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
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.
Adjust regex to be more resilient
Pull Request Type
Related issue
Follow-up to #115
Closes #118
Description
I just realized that the regular expression used for finding channel names uses strings pulled from the YT response without sanitizing them first, and this will mean that any video with a symbol in the title could cause unexpected behavior. Vsauce is a really good example of this because they have lots of videos with weird symbols in the titles (EX: "mí͇͔̠śtk̥̞àẹ̶̢̪s "). I also added a loop to increase the likelihood that the channel name will be able to be successfully retrieved in channel page continuations.
If absolutely none of the videos in the continuation contain accessibility data which can be parsed, it still won't throw, but it will pass back the
channelName
as undefined. In FreeTube, this should just mean thechannelName
won't display at all under the video which isn't the best thing in the world, but it is still better than simply throwing in the case of a catastrophic failure.Screenshots
before:
after: