From f502283d6caa8f07a7320434e9268501d6fff725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=81nis=20L?= Date: Wed, 22 Jul 2026 20:29:55 +0300 Subject: [PATCH] fix miruro --- manifest.json | 4 ++-- providers/miruro.js | 15 +++++++++++---- src/miruro/extractor.js | 17 +++++++++++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/manifest.json b/manifest.json index cab6fdb..da3dc97 100644 --- a/manifest.json +++ b/manifest.json @@ -1,12 +1,12 @@ { "name": "Nuvio Providers", - "version": "1.0.10", + "version": "1.0.11", "scrapers": [ { "id": "miruro", "name": "Miruro", "description": "Anime streams from Miruro with subbed and dubbed sources.", - "version": "1.0.3", + "version": "1.0.4", "author": "Jānis L", "supportedTypes": [ "movie", diff --git a/providers/miruro.js b/providers/miruro.js index 0439c4c..c32a473 100644 --- a/providers/miruro.js +++ b/providers/miruro.js @@ -558,6 +558,12 @@ function asNumber(value) { const number = Number(value); return Number.isFinite(number) ? number : null; } +function asArray(value) { + if (value == null) { + return []; + } + return Array.isArray(value) ? value : [value]; +} function parseIdentifier(value) { const id = String(value || "").trim(); if (/^tt\d+$/i.test(id)) { @@ -571,11 +577,12 @@ function parseIdentifier(value) { function recordMatchesIdentifier(record, identifier, mediaType) { const expectedType = mediaType === "movie" ? "movie" : "tv"; if (identifier.service === "imdb") { - const imdbMatches = (record.imdb_id || []).some((id) => String(id).toLowerCase() === identifier.value); - const typeMatches = (record.tmdb_id || []).length === 0 || (record.tmdb_id || []).some((mapping) => mapping.type === expectedType); + const imdbMatches = asArray(record.imdb_id).some((id) => String(id).toLowerCase() === identifier.value); + const tmdbMappings = asArray(record.tmdb_id); + const typeMatches = tmdbMappings.length === 0 || tmdbMappings.some((mapping) => mapping.type === expectedType); return imdbMatches && typeMatches; } - return (record.tmdb_id || []).some((mapping) => String(mapping.id) === identifier.value && mapping.type === expectedType); + return asArray(record.tmdb_id).some((mapping) => String(mapping.id) === identifier.value && mapping.type === expectedType); } function getAniListIds(records, identifier, mediaType) { const ids = []; @@ -584,7 +591,7 @@ function getAniListIds(records, identifier, mediaType) { if (!recordMatchesIdentifier(record, identifier, mediaType)) { continue; } - for (const id of record.anilist_id || []) { + for (const id of asArray(record.anilist_id)) { const numericId = asNumber(id); if (numericId && !ids.includes(numericId)) { ids.push(numericId); diff --git a/src/miruro/extractor.js b/src/miruro/extractor.js index 4ba6596..871e2bc 100644 --- a/src/miruro/extractor.js +++ b/src/miruro/extractor.js @@ -24,6 +24,14 @@ function asNumber(value) { return Number.isFinite(number) ? number : null; } +function asArray(value) { + if (value == null) { + return []; + } + + return Array.isArray(value) ? value : [value]; +} + function parseIdentifier(value) { const id = String(value || '').trim(); @@ -42,17 +50,18 @@ function recordMatchesIdentifier(record, identifier, mediaType) { const expectedType = mediaType === 'movie' ? 'movie' : 'tv'; if (identifier.service === 'imdb') { - const imdbMatches = (record.imdb_id || []).some((id) => ( + const imdbMatches = asArray(record.imdb_id).some((id) => ( String(id).toLowerCase() === identifier.value )); - const typeMatches = (record.tmdb_id || []).length === 0 || (record.tmdb_id || []).some((mapping) => ( + const tmdbMappings = asArray(record.tmdb_id); + const typeMatches = tmdbMappings.length === 0 || tmdbMappings.some((mapping) => ( mapping.type === expectedType )); return imdbMatches && typeMatches; } - return (record.tmdb_id || []).some((mapping) => ( + return asArray(record.tmdb_id).some((mapping) => ( String(mapping.id) === identifier.value && mapping.type === expectedType )); } @@ -70,7 +79,7 @@ function getAniListIds(records, identifier, mediaType) { continue; } - for (const id of record.anilist_id || []) { + for (const id of asArray(record.anilist_id)) { const numericId = asNumber(id); if (numericId && !ids.includes(numericId)) {