fix: Handle double-encoded JSON in getStream function

This commit is contained in:
himanshu8443
2025-10-11 10:52:38 +05:30
parent 7f5fb81c33
commit c1fc264c6a
2 changed files with 9 additions and 2 deletions

View File

@@ -92,7 +92,14 @@ export const getStream = async function ({
}
console.log(id);
const streams: Stream[] = [];
const { imdbId, season, episode } = JSON.parse(id);
// Handle double-encoded JSON
let parsedId = typeof id === "string" ? JSON.parse(id) : id;
if (typeof parsedId === "string") {
parsedId = JSON.parse(parsedId);
}
const { imdbId, season, episode } = parsedId;
console.log("Parsed ID:", parsedId);
console.log("imdbId:", imdbId);
///// mostraguarda
const mostraguardaStream = await GetMostraguardaStream({