feat: add extractors bundled in file refactor stream handling in multiple providers

This commit is contained in:
Himanshu
2026-02-02 23:24:38 +05:30
parent 2183412dc8
commit 13d41f9da6
220 changed files with 1300 additions and 771 deletions

View File

@@ -0,0 +1,37 @@
export async function gofileExtractor(
id: string,
axios: any,
): Promise<{ link: string; token: string }> {
try {
const gofileRes = await axios.get("https://gofile.io/d/" + id);
const genAccountres = await axios.post("https://api.gofile.io/accounts");
const token = genAccountres.data.data.token;
console.log("gofile token", token);
const wtRes = await axios.get("https://gofile.io/dist/js/global.js");
const wt = wtRes.data.match(/appdata\.wt\s*=\s*["']([^"']+)["']/)[1];
console.log("gofile wt", wt);
const res = await axios.get(
`https://api.gofile.io/contents/${id}?wt=${wt}`,
{
headers: {
Authorization: `Bearer ${token}`,
},
},
);
const oId = Object.keys(res.data.data.children)[0];
console.log("gofileExtractor", res.data.data.children[oId].link);
const link = res.data.data.children[oId].link;
return {
link,
token,
};
} catch (e) {
console.log("gofileExtractor error", e);
return {
link: "",
token: "",
};
}
}