]+id="wrapper"[^>]+data-id="(\d+)"[^>]*>/);
if (!idMatch) throw new Error("movie_id not found");
const movieId = idMatch[1];
const epListResp = await fetchv2(`https://hicartoon.to/ajax/v2/episode/list?movie_id=${movieId}`);
const epListJson = await epListResp.json();
const epHtml = epListJson.html;
const epRegex = /]+class="ssl-item ep-item"[^>]+data-id="(\d+)"[^>]+href="([^"]+)"[^>]*>[\s\S]*?
]*>([^<]+)<\/div>[\s\S]*?
]*>([^<]+)<\/div>/g;
let match;
let idx = 1;
while ((match = epRegex.exec(epHtml)) !== null) {
results.push({
href: match[1],
number: idx
});
idx++;
}
return JSON.stringify(results);
} catch (err) {
console.error(err);
return JSON.stringify([{ id: "Error", href: "Error", number: "Error", title: "Error" }]);
}
}
async function extractStreamUrl(ID) {
try {
let response;
let json;
let iframeMatch;
// Try tserver
try {
response = await fetchv2(`https://hicartoon.to/ajax/v2/episode/sources?id=${ID}&s=tserver`);
json = await response.json();
iframeMatch = json.value ? json.value.match(/