kitsu bug fix

This commit is contained in:
tapframe 2025-09-21 13:44:55 +05:30
parent a0d33be096
commit 47dfaa26c0
2 changed files with 39 additions and 16 deletions

View file

@ -871,7 +871,17 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
let supportsIdPrefix = false; let supportsIdPrefix = false;
// Extract ID prefix from the ID // Extract ID prefix from the ID
const idPrefix = id.split(':')[0]; let idPrefix = id.split(':')[0];
// For IMDb IDs (tt...), extract just the 'tt' prefix
if (idPrefix.startsWith('tt')) {
idPrefix = 'tt';
}
// For Kitsu IDs, keep the full prefix
else if (idPrefix === 'kitsu') {
idPrefix = 'kitsu';
}
// For other prefixes, keep as is
for (const resource of addon.resources) { for (const resource of addon.resources) {
// Check if the current element is a ResourceObject // Check if the current element is a ResourceObject

View file

@ -930,11 +930,11 @@ class StremioService {
let tmdbId: string | null = null; let tmdbId: string | null = null;
let season: number | undefined = undefined; let season: number | undefined = undefined;
let episode: number | undefined = undefined; let episode: number | undefined = undefined;
let idType: 'imdb' | 'kitsu' | 'tmdb' = 'imdb';
try { try {
const idParts = id.split(':'); const idParts = id.split(':');
let baseId: string; let baseId: string;
let idType: 'imdb' | 'kitsu' | 'tmdb' = 'imdb';
// Handle different episode ID formats // Handle different episode ID formats
if (idParts[0] === 'series') { if (idParts[0] === 'series') {
@ -991,24 +991,26 @@ class StremioService {
} else { } else {
// For kitsu IDs, skip local scrapers as they don't support kitsu // For kitsu IDs, skip local scrapers as they don't support kitsu
logger.log('🔧 [getStreams] Skipping local scrapers for kitsu ID:', baseId); logger.log('🔧 [getStreams] Skipping local scrapers for kitsu ID:', baseId);
return; // Don't return here - continue to Stremio addon processing
} }
} catch (error) { } catch (error) {
return; // Skip local scrapers if ID parsing fails return; // Skip local scrapers if ID parsing fails
} }
// Execute local scrapers asynchronously with TMDB ID // Execute local scrapers asynchronously with TMDB ID (only for IMDb IDs)
localScraperService.getStreams(scraperType, tmdbId, season, episode, (streams, scraperId, scraperName, error) => { if (idType === 'imdb' && tmdbId) {
if (error) { localScraperService.getStreams(scraperType, tmdbId, season, episode, (streams, scraperId, scraperName, error) => {
if (callback) { if (error) {
callback(null, scraperId, scraperName, error); if (callback) {
callback(null, scraperId, scraperName, error);
}
} else if (streams && streams.length > 0) {
if (callback) {
callback(streams, scraperId, scraperName, null);
}
} }
} else if (streams && streams.length > 0) { });
if (callback) { }
callback(streams, scraperId, scraperName, null);
}
}
});
} }
} }
} catch (error) { } catch (error) {
@ -1036,8 +1038,19 @@ class StremioService {
let supportsIdPrefix = false; let supportsIdPrefix = false;
// Extract ID prefix from the ID // Extract ID prefix from the ID
const idPrefix = id.split(':')[0]; let idPrefix = id.split(':')[0];
logger.log(`🔍 [getStreams] Checking if addon supports ID prefix: ${idPrefix}`);
// For IMDb IDs (tt...), extract just the 'tt' prefix
if (idPrefix.startsWith('tt')) {
idPrefix = 'tt';
}
// For Kitsu IDs, keep the full prefix
else if (idPrefix === 'kitsu') {
idPrefix = 'kitsu';
}
// For other prefixes, keep as is
logger.log(`🔍 [getStreams] Checking if addon supports ID prefix: ${idPrefix} (from ${id.split(':')[0]})`);
// Iterate through the resources array, checking each element // Iterate through the resources array, checking each element
for (const resource of addon.resources) { for (const resource of addon.resources) {