Shahriyaahh/downloader_69RobotPublic · Bot Template
🎬 Universal Downloader Bot is a fast and easy-to-use Telegram bot that lets you download videos from Facebook, Instagram, and YouTube with a single command. Simply send "/dl <video_link>", and the bot will fetch the video for you in seconds.
Utilitydownloadervideofacebookinstagramyoutubeping
9 commands0 envUpdated 26d agoCreated Aug 6, 2026
commands/_dl.js
javascript · 135 lines
1/**#command2name: /dl3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12function cleanFBTitle(rawTitle) {13 if (!rawTitle) return {};14 15 let parts = rawTitle.split("|").map(p => p.trim());16 let stats = parts[0] || "";17 let title = parts[1] || rawTitle;18 19 let views = stats.match(/([\d.,]+)\s*(M|K)?\s*views/i)?.[0] || null;20 let reactions = stats.match(/([\d.,]+)\s*(M|K)?\s*reactions/i)?.[0] || null;21 22 return {23 title,24 views,25 reactions26 };27}28 29async function getFBVideo(link) {30 31 let m = await Bot.sendMessage("⏳ Downloading");32 let mid = m.result.message_id;33 34 await Api.editMessageText({35 chat_id: chat.id,36 message_id: mid,37 text: "⏳ Downloading."38 });39 40 // Don't send User-Agent41 let headers = {42 Accept: "application/json",43 "Content-Type": "application/json",44 Origin: "https://ytdownload.in",45 Referer: "https://ytdownload.in/"46 };47 48 let res = await HTTP.post({49 url: Bot.get("downloader_api"),50 headers: headers,51 body: {52 url: link,53 format: "mp4",54 quality: "1080p"55 }56 });57 58 await Api.editMessageText({59 chat_id: chat.id,60 message_id: mid,61 text: "⏳ Downloading.."62 });63 64 if (!res.ok) {65 return Api.editMessageText({66 chat_id: chat.id,67 message_id: mid,68 text: "❌ Failed to connect to API."69 });70 }71 72 if (!res.data || !res.data.responseFinal) {73 return Api.editMessageText({74 chat_id: chat.id,75 message_id: mid,76 text: "❌ Video not found or private."77 });78 }79 80 await Api.editMessageText({81 chat_id: chat.id,82 message_id: mid,83 text: "⏳ Uploading..."84 });85 86 let r = res.data.responseFinal;87 88 let video =89 r.videoUrl ||90 r.formats?.find(v => v.qualityLabel?.includes("HD"))?.url ||91 r.formats?.[0]?.url;92 93 if (!video) {94 return Api.editMessageText({95 chat_id: chat.id,96 message_id: mid,97 text: "❌ HD video not available."98 });99 }100 101 let info = cleanFBTitle(r.title);102 103 let caption =104 "<b>" + (info.title || "Facebook Video") + "</b>\n\n" +105 (info.views ? "👁️ " + info.views + "\n" : "") +106 (info.reactions ? "❤️ " + info.reactions + "\n" : "");107 108 let name = user.first_name;109 if (user.last_name) name += " " + user.last_name;110 111 await Api.editMessageMedia({112 chat_id: chat.id,113 message_id: mid,114 media: {115 type: "video",116 media: video,117 caption:118 caption +119 `\n<blockquote><b>Downloaded by:</b> <a href="tg://user?id=${user.id}">${name}</a></blockquote>`,120 parse_mode: "HTML"121 }122 });123}124 125/* Command Handler */126 127if (request.reply_to_message?.text) {128 getFBVideo(request.reply_to_message.text);129} else if (params) {130 getFBVideo(params);131} else {132 Api.sendMessage({133 text: "❗ Please provide a Valid video link."134 });135}