fix: update getStream function to handle redirect links

This commit is contained in:
himanshu8443
2025-06-23 14:36:14 +05:30
parent 387d7ba6c1
commit aee79858cd
2 changed files with 27 additions and 8 deletions

View File

@@ -7,10 +7,7 @@ export const getStream = async function ({
}): Promise<Stream[]> {
try {
const streams: Stream[] = [];
streams.push({
server: "Dooflix",
link: link,
type: "m3u8",
const response = await fetch(link, {
headers: {
Connection: "Keep-Alive",
"User-Agent":
@@ -20,6 +17,19 @@ export const getStream = async function ({
"cf_clearance=M2_2Hy4lKRy_ruRX3dzOgm3iho1FHe2DUC1lq28BUtI-1737377622-1.2.1.1-6R8RaH94._H2BuNuotsjTZ3fAF6cLwPII0guemu9A5Xa46lpCJPuELycojdREwoonYS2kRTYcZ9_1c4h4epi2LtDvMM9jIoOZKE9pIdWa30peM1hRMpvffTjGUCraHsJNCJez8S_QZ6XkkdP7GeQ5iwiYaI6Grp6qSJWoq0Hj8lS7EITZ1LzyrALI6iLlYjgLmgLGa1VuhORWJBN8ZxrJIZ_ba_pqbrR9fjnyToqxZ0XQaZfk1d3rZyNWoZUjI98GoAxVjnKtcBQQG6b2jYPJuMbbYraGoa54N7E7BR__7o",
},
});
// if 300 get redirect link
if (response.status >= 300 && response.status < 400) {
const redirectLink = response.headers.get("Location");
if (redirectLink) {
link = redirectLink;
}
}
streams.push({
server: "Dooflix",
link: link,
type: "m3u8",
});
console.log("doo streams", streams);
return streams;
} catch (err) {