Small fix for Kokoshka source #453

Closed
opened 2025-10-22 12:08:02 +00:00 by GLlgGL · 3 comments
GLlgGL commented 2025-10-22 12:08:02 +00:00 (Migrated from github.com)

Hi

There is a case where you search for a movie that doesn't exist in the website but the search give results of old movies.

The solution would be to add a strict check between title and year from tmdb and title and year in the html(after the search query)...

Case where it happens?

Go on the movie called "Steve" on stremio and see that kokoshka will fetch other movies because the "Steve" movie doesn't exist there.

On my test I fixed with this code, of course might need more adjustment.

if (type === 'movie') {
const normalize = (str: string) =>
str.toLowerCase().replace(/[:!?.,'"()-]/g, '').replace(/\s+/g, ' ').trim();

    const normMatched = normalize(matchedTitle);
    const normSearch = normalize(searchTitle);

    const titleMatch = normMatched.includes(normSearch);
    const yearMatch = normMatched.includes(searchYear);

   
    if (!titleMatch || (!yearMatch && Math.abs(normMatched.length - normSearch.length) > 5)) {
      console.warn(`[Kokoshka] No close match for "${cleanTitle}" (${year})`);
      return [];
    }
  }

With this fix the source would be perfect because I tested in different aspects and this was the olny bug I found.

Hi There is a case where you search for a movie that doesn't exist in the website but the search give results of old movies. The solution would be to add a strict check between title and year from tmdb and title and year in the html(after the search query)... Case where it happens? Go on the movie called "Steve" on stremio and see that kokoshka will fetch other movies because the "Steve" movie doesn't exist there. On my test I fixed with this code, of course might need more adjustment. if (type === 'movie') { const normalize = (str: string) => str.toLowerCase().replace(/[:!?.,'"()\-]/g, '').replace(/\s+/g, ' ').trim(); const normMatched = normalize(matchedTitle); const normSearch = normalize(searchTitle); const titleMatch = normMatched.includes(normSearch); const yearMatch = normMatched.includes(searchYear); if (!titleMatch || (!yearMatch && Math.abs(normMatched.length - normSearch.length) > 5)) { console.warn(`[Kokoshka] No close match for "${cleanTitle}" (${year})`); return []; } } With this fix the source would be perfect because I tested in different aspects and this was the olny bug I found.
webstreamr commented 2025-10-24 14:45:02 +00:00 (Migrated from github.com)

unfortunately your code snippet does not match any of what we have atm. so basically, to confirm, we can normalize name/title when doing a search and for movies we should additionally check that the year diff is <= 5, is that correct?

unfortunately your code snippet does not match any of what we have atm. so basically, to confirm, we can normalize name/title when doing a search and for movies we should additionally check that the year diff is <= 5, is that correct?
GLlgGL commented 2025-10-24 19:37:11 +00:00 (Migrated from github.com)

The logic

Normalize

If the title doesn’t match at all → reject.

Or, if the year doesn’t match and the titles differ too much in length (difference > 5 characters) → reject.

The logic Normalize If the title doesn’t match at all → reject. Or, if the year doesn’t match and the titles differ too much in length (difference > 5 characters) → reject.
webstreamr commented 2025-10-29 11:32:18 +00:00 (Migrated from github.com)

came up with something similar in bbdd968. we can fine-tune that of course and add normalizing if needed, so far it was looking quite good

came up with something similar in bbdd968. we can fine-tune that of course and add normalizing if needed, so far it was looking quite good
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Creepso/webstreamr-github#453
No description provided.