LucasMod

Terabox_DL

Nov 9th, 2025
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 2.22 KB | Source Code | 0 0
  1. //By: 𖧄 𝐋𝐔𝐂𝐀𝐒 𝐌𝐎𝐃 𝐃𝐎𝐌𝐈𝐍𝐀 𖧄
  2. //Canal: https://whatsapp.com/channel/0029Vb69bDnAe5VmzSMwBH11
  3.  
  4. const axios = require("axios");
  5. const https = require("https");
  6. const FormData = require("form-data");
  7.  
  8. const httpsAgent = new https.Agent({ rejectUnauthorized: true });
  9.  
  10. function kyahhh(k) {
  11. return k.replace(/[\p{Emoji_Presentation}\p{Emoji}\uFE0F]/gu, "").trim().replace(/\s+/g, "_");
  12. }
  13.  
  14. function obj(x) {
  15. if (Array.isArray(x)) return x.map(v => obj(v));
  16. if (x && typeof x === "object") {
  17. const out = {};
  18. for (const key in x) out[kyahhh(key)] = obj(x[key]);
  19. return out;
  20. }
  21. return x;
  22. }
  23.  
  24. async function getNonce(url) {
  25. const html = (await axios.get(url, { httpsAgent })).data;
  26. const m = html.match(/var\s+terabox_ajax\s*=\s*(\{[\s\S]*?\});/m);
  27. if (!m) return null;
  28. try {
  29. return JSON.parse(m[1]).nonce ?? null;
  30. } catch {
  31. return null;
  32. }
  33. }
  34.  
  35. async function teraboxDL(link, opt = {}) {
  36. const parse = opt.parse_result ?? false;
  37. const nonce = await getNonce("https://teradownloadr.com/");
  38. const form = new FormData();
  39. form.append("action", "terabox_fetch");
  40. form.append("url", link);
  41. form.append("nonce", nonce);
  42. const { data } = await axios.post("https://teradownloadr.com/wp-admin/admin-ajax.php", form, { headers: form.getHeaders(), httpsAgent });
  43. return parse ? obj(data.data) : data.data;
  44. }
  45.  
  46. module.exports = { teraboxDL }
  47.  
  48. /*
  49. EXEMPLO DE USO:
  50.  
  51. const { teraboxDL } = require('./teraboxdl');
  52.  
  53. async function baixarArquivo() {
  54. try {
  55. const url = "https://terabox.com/s/1abc123def456ghi";
  56. const resultado = await teraboxDL(url, { parse_result: true });
  57. console.log("Download preparado com sucesso:");
  58. console.log(JSON.stringify(resultado, null, 2));
  59. // Se quiser o resultado sem parse
  60. // const resultadoSimples = await teraboxDL(url);
  61. // console.log(resultadoSimples);
  62. } catch (erro) {
  63. console.error("Erro ao baixar:", erro.message);
  64. }
  65. }
  66. // baixarArquivo();
  67.  
  68. FUNÇÕES:
  69. - teraboxDL(link, opcoes): Baixa informações de arquivo do TeraBox
  70. - Opções: { parse_result: true } para formatar os nomes das chaves
  71.  
  72. CARACTERÍSTICAS:
  73. - Remove emojis e espaços dos nomes das chaves (quando parse_result é true)
  74. - Usa agente HTTPS seguro
  75. - Obtém nonce automaticamente do site
  76. */
Advertisement
Add Comment
Please, Sign In to add comment