mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
fix: update getStream function to handle redirect links
This commit is contained in:
17
dist/dooflix/stream.js
vendored
17
dist/dooflix/stream.js
vendored
@@ -14,10 +14,7 @@ const getStream = function (_a) {
|
|||||||
return __awaiter(this, arguments, void 0, function* ({ link, }) {
|
return __awaiter(this, arguments, void 0, function* ({ link, }) {
|
||||||
try {
|
try {
|
||||||
const streams = [];
|
const streams = [];
|
||||||
streams.push({
|
const response = yield fetch(link, {
|
||||||
server: "Dooflix",
|
|
||||||
link: link,
|
|
||||||
type: "m3u8",
|
|
||||||
headers: {
|
headers: {
|
||||||
Connection: "Keep-Alive",
|
Connection: "Keep-Alive",
|
||||||
"User-Agent": "Mozilla/5.0 (WindowsNT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.37",
|
"User-Agent": "Mozilla/5.0 (WindowsNT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.37",
|
||||||
@@ -25,6 +22,18 @@ const getStream = function (_a) {
|
|||||||
Cookie: "cf_clearance=M2_2Hy4lKRy_ruRX3dzOgm3iho1FHe2DUC1lq28BUtI-1737377622-1.2.1.1-6R8RaH94._H2BuNuotsjTZ3fAF6cLwPII0guemu9A5Xa46lpCJPuELycojdREwoonYS2kRTYcZ9_1c4h4epi2LtDvMM9jIoOZKE9pIdWa30peM1hRMpvffTjGUCraHsJNCJez8S_QZ6XkkdP7GeQ5iwiYaI6Grp6qSJWoq0Hj8lS7EITZ1LzyrALI6iLlYjgLmgLGa1VuhORWJBN8ZxrJIZ_ba_pqbrR9fjnyToqxZ0XQaZfk1d3rZyNWoZUjI98GoAxVjnKtcBQQG6b2jYPJuMbbYraGoa54N7E7BR__7o",
|
Cookie: "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);
|
console.log("doo streams", streams);
|
||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,7 @@ export const getStream = async function ({
|
|||||||
}): Promise<Stream[]> {
|
}): Promise<Stream[]> {
|
||||||
try {
|
try {
|
||||||
const streams: Stream[] = [];
|
const streams: Stream[] = [];
|
||||||
streams.push({
|
const response = await fetch(link, {
|
||||||
server: "Dooflix",
|
|
||||||
link: link,
|
|
||||||
type: "m3u8",
|
|
||||||
headers: {
|
headers: {
|
||||||
Connection: "Keep-Alive",
|
Connection: "Keep-Alive",
|
||||||
"User-Agent":
|
"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",
|
"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);
|
console.log("doo streams", streams);
|
||||||
return streams;
|
return streams;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user