Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //By: 𖧄 𝐋𝐔𝐂𝐀𝐒 𝐌𝐎𝐃 𝐃𝐎𝐌𝐈𝐍𝐀 𖧄
- //Canal: https://whatsapp.com/channel/0029Vb69bDnAe5VmzSMwBH11
- const axios = require("axios");
- const https = require("https");
- const FormData = require("form-data");
- const httpsAgent = new https.Agent({ rejectUnauthorized: true });
- function kyahhh(k) {
- return k.replace(/[\p{Emoji_Presentation}\p{Emoji}\uFE0F]/gu, "").trim().replace(/\s+/g, "_");
- }
- function obj(x) {
- if (Array.isArray(x)) return x.map(v => obj(v));
- if (x && typeof x === "object") {
- const out = {};
- for (const key in x) out[kyahhh(key)] = obj(x[key]);
- return out;
- }
- return x;
- }
- async function getNonce(url) {
- const html = (await axios.get(url, { httpsAgent })).data;
- const m = html.match(/var\s+terabox_ajax\s*=\s*(\{[\s\S]*?\});/m);
- if (!m) return null;
- try {
- return JSON.parse(m[1]).nonce ?? null;
- } catch {
- return null;
- }
- }
- async function teraboxDL(link, opt = {}) {
- const parse = opt.parse_result ?? false;
- const nonce = await getNonce("https://teradownloadr.com/");
- const form = new FormData();
- form.append("action", "terabox_fetch");
- form.append("url", link);
- form.append("nonce", nonce);
- const { data } = await axios.post("https://teradownloadr.com/wp-admin/admin-ajax.php", form, { headers: form.getHeaders(), httpsAgent });
- return parse ? obj(data.data) : data.data;
- }
- module.exports = { teraboxDL }
- /*
- EXEMPLO DE USO:
- const { teraboxDL } = require('./teraboxdl');
- async function baixarArquivo() {
- try {
- const url = "https://terabox.com/s/1abc123def456ghi";
- const resultado = await teraboxDL(url, { parse_result: true });
- console.log("Download preparado com sucesso:");
- console.log(JSON.stringify(resultado, null, 2));
- // Se quiser o resultado sem parse
- // const resultadoSimples = await teraboxDL(url);
- // console.log(resultadoSimples);
- } catch (erro) {
- console.error("Erro ao baixar:", erro.message);
- }
- }
- // baixarArquivo();
- FUNÇÕES:
- - teraboxDL(link, opcoes): Baixa informações de arquivo do TeraBox
- - Opções: { parse_result: true } para formatar os nomes das chaves
- CARACTERÍSTICAS:
- - Remove emojis e espaços dos nomes das chaves (quando parse_result é true)
- - Usa agente HTTPS seguro
- - Obtém nonce automaticamente do site
- */
Advertisement
Add Comment
Please, Sign In to add comment