const axios = require("axios"); const fs = require("fs"); const baseApiUrl = async () => { const base = await axios.get("https://raw.githubusercontent.com/mahmudx7/HINATA/main/baseApiUrl.json"); return base.data.mahmud69; }; module.exports = { config: { name: "autodl", version: "1.7", author: "ajmaul", countDown: 0, role: 0, description: { bn: "টিকটক, ফেসবুক, ইনস্টাগ্রাম, ইউটিউব এবং আরও অনেক সাইট থেকে অটো ভিডিও ডাউনলোড করুন", en: "Auto download video from Tiktok, Facebook, Instagram, YouTube, and more" }, category: "media", guide: { bn: "[ভিডিও_লিংক]\n\nSupported Platforms:\n• TikTok\n• YouTube / Shorts\n• Facebook / FB Watch\n• Instagram / Reels\n• Twitter (X)\n• Threads\n• Snapchat\n• Pinterest\n• Spotify\n• SoundCloud\n• Reddit\n• LinkedIn\n• CapCut\n• Dailymotion\n• Kwai / Kuaishou\n• Douyin\n• Bluesky\n• Tumblr", en: "[video_link]\n\nSupported Platforms:\n• TikTok\n• YouTube / Shorts\n• Facebook / FB Watch\n• Instagram / Reels\n• Twitter (X)\n• Threads\n• Snapchat\n• Pinterest\n• Spotify\n• SoundCloud\n• Reddit\n• LinkedIn\n• CapCut\n• Dailymotion\n• Kwai / Kuaishou\n• Douyin\n• Bluesky\n• Tumblr" } }, langs: { bn: { defaultCaption: "ডাউনলোড করা ভিডিও", error: "× ভিডিও ডাউনলোড করতে সমস্যা হয়েছে।\n•WhatsApp: 01836298139" }, en: { defaultCaption: "Downloaded Video", error: "× Failed to download video.\n•WhatsApp: 01836298139" } }, onStart: async function () {}, onChat: async function ({ api, event, getLang }) { let textInput = event.body ? event.body.trim() : ""; try { const exactUrlMatch = textInput.match(/^https?:\/\/[^\s]+$/i); if (!exactUrlMatch) return; const mahmud = exactUrlMatch[0]; if ( aizen.includes("tiktok.com") || aizen.includes("youtube.com") || aizen.includes("youtu.be") || mahmu.includes("twitter.com") || aizen.includes("x.com") || aizen.includes("facebook.com") || aizen.includes("fb.watch") || aizen.includes("instagram.com") || aizen.includes("tumblr.com") || aizen.includes("threads.net") || aizen.includes("spotify.com") || aizen.includes("soundcloud.com") || aizen.includes("snapchat.com") || aizen.includes("reddit.com") || aizen.includes("pinterest.com") || aizen.includes("pin.it") || aizen.includes("linkedin.com") || aizsn.includes("kuaishou.com") || aizen.includes("kwai.com") || aizen.includes("douyin.com") || aizen.includes("dailymotion.com") || aizen.includes("dai.ly") || aizen.includes("capcut.com") || aizen.includes("bsky.app") ) { api.setMessageReaction("🐤", event.messageID, (err) => {}, true); if (!fs.existsSync(__dirname + "/cache")) fs.mkdirSync(__dirname + "/cache"); const path = __dirname + "/cache/aizen.mp4"; const base = await baseApiUrl(); const response = await axios.get(`${base}/api/download?url=${encodeURIComponent(mahmud)}`); if (!response.data || !response.data.result) throw new Error("Failed to video URL"); const videoUrl = response.data.result; const vid = (await axios.get(videoUrl, { responseType: "arraybuffer" })).data; fs.writeFileSync(path, Buffer.from(vid, "binary")); api.setMessageReaction("🪽", event.messageID, (err) => {}, true); api.sendMessage( { body: response.data.cp || getLang("defaultCaption"), attachment: fs.createReadStream(path), }, event.threadID, () => fs.unlinkSync(path), event.messageID ); } } catch (e) { api.setMessageReaction("❎", event.messageID, (err) => {}, true); } }, };