feat(api): make rottentomatoes matching more robust #1265
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
Replaces the RT search result matching logic with a ranking system that should be more robust. Also changes RT search queries to only search for the desired result type (
movie
ortv
) and strips "The" from movie search queries.From my testing so far, this fixes a handful of mismatched ratings, but there are some matches that this fails on in the same way as the old logic. Usually the examples that still fail are just absurd data, like results with release years that disagree by more than 1 year (eg, Terrifier which finished production in 2016 but wasn't widely released until 2018) or just have bad RT entries (eg, Nightmare Before Christmas which has two RT entries: one with all the ratings called Tim Burton's Nightmare Before Christmas, and another dummy entry with no ratings called just Nightmare Before Christmas which always matches better).
I want to make sure this doesn't make any matches worse, so I'm leaving it as a draft until I have time to do some more comprehensive testing. I've scraped the RT search results for the first ~1000 movies in Jellyseerr's Movies tab and fed them through the old and new logic, but I still need to test TV show matching and changes to the search query.
Gotta name all the magic numbers too.
To-Dos
pnpm build
pnpm i18n:extract
Issues Fixed or Closed