Created
July 9, 2025 20:24
-
-
Save dipto-008/3dd66cbc2321814c04acb6b796c8f7e8 to your computer and use it in GitHub Desktop.
Hey noob ππ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require("axios"); | |
const fs = require("fs"); | |
const { shortenURL } = global.utils; | |
const baseApiUrl = "https://www.noobs-api.rf.gd/dipto"; | |
module.exports = { | |
config: { | |
name: "autodl", | |
version: "1.0.1", | |
author: "404", | |
countDown: 0, | |
role: 0, | |
description: { | |
en: "Auto download video from Tiktok, Facebook, Instagram, YouTube, and more", | |
}, | |
category: "media", | |
guide: { | |
en: "[video_link]", | |
}, | |
}, | |
onStart: async function () {}, | |
onChat: async function ({ api, event }) { | |
let dipto = event.body ? event.body.trim() : ""; | |
try { | |
if ( | |
dipto.startsWith("https://vt.tiktok.com") || | |
dipto.startsWith("https://www.tiktok.com/") || | |
dipto.startsWith("https://www.facebook.com") || | |
dipto.startsWith("https://www.instagram.com/") || | |
dipto.startsWith("https://youtu.be/") || | |
dipto.startsWith("https://youtube.com/") || | |
dipto.startsWith("https://x.com/") || | |
dipto.startsWith("https://twitter.com/") || | |
dipto.startsWith("https://vm.tiktok.com") || | |
dipto.startsWith("https://fb.watch") | |
) { | |
api.setMessageReaction("π€", event.messageID, (err) => {}, true); | |
if(!fs.existsSync(__dirname+"/cache")) fs.mkdirSync(__dirname+"/cache") | |
const path = __dirname + "/cache/diptoo.mp4"; | |
const response = await axios.get(`${baseApiUrl}/alldl?url=${encodeURIComponent(dipto)}`); | |
if (!response.data || !response.data.result) throw new Error("Failed to fetch video URL"); | |
const videoUrl = response.data.result; | |
const vid = (await axios.get(videoUrl, { responseType: "arraybuffer" })).data; | |
fs.writeFileSync(path, Buffer.from(vid, "binary")); | |
const url = await shortenURL(videoUrl); | |
api.sendMessage( | |
{ | |
body: `${response.data.cp || "Downloaded Video"}\nπ€ | Link: ${url || "Unavailable"}`, | |
attachment: fs.createReadStream(path), | |
}, | |
event.threadID, | |
() => fs.unlinkSync(path), | |
event.messageID | |
); | |
} | |
} catch (e) { | |
api.setMessageReaction("β", event.messageID, (err) => {}, true); | |
api.sendMessage(`Error: ${e.message}`, event.threadID, event.messageID); | |
} | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment