Last active
January 20, 2024 08:19
-
-
Save FantoX/2de67bc72021805417cbd317385ea71a to your computer and use it in GitHub Desktop.
TikTok video and audio downloader
This file contains 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
let mergedCommands = [ | |
"tiktok", | |
"tiktokdl", | |
"tiktokmp3", | |
"tiktokmp4", | |
"tiktokdoc", | |
]; | |
module.exports = { | |
name: "tiktokDl", | |
alias: [...mergedCommands], | |
uniquecommands: ["tiktok", "tiktokmp3", "tiktokmp4", "tiktokdoc"], | |
description: "All Tiktok Downloader Commands", | |
start: async ( | |
Atlas, | |
m, | |
{ inputCMD, text, prefix, doReact, args, isMedia, quoted } | |
) => { | |
if (!text) { | |
await doReact("❌"); | |
return m.reply( | |
`Please provide a Toktok video link !\n\nExample: ${prefix}say Atlas MD is OP` | |
); | |
} | |
if (!text.includes("tiktok")) { | |
await doReact("❌"); | |
return m.reply("Please provide a valid Tiktok link!"); | |
} | |
switch (inputCMD) { | |
case "tiktok": | |
case "tiktokdl": | |
await doReact("📥"); | |
let buttons = [ | |
{ | |
buttonId: `${prefix}tiktokmp3 ${args[0]}`, | |
buttonText: { displayText: "♬ Audio" }, | |
type: 1, | |
}, | |
{ | |
buttonId: `${prefix}tiktokmp4 ${args[0]}`, | |
buttonText: { displayText: "▶ Video" }, | |
type: 1, | |
}, | |
{ | |
buttonId: `${prefix}tiktokdoc ${args[0]}`, | |
buttonText: { displayText: "∎ Document" }, | |
type: 1, | |
}, | |
]; | |
txtmain = ` | |
*『 Tiktok Downloader 』* | |
*🧩 Video Url :* _${text}_\n\n | |
*📌 Select the format* | |
*${prefix}tiktokmp3 <link>* | |
*${prefix}tiktokmp4 <link>* | |
*${prefix}tiktokdoc <link>*`; | |
Atlas.sendMessage( | |
m.from, | |
{ image: { url: botImage1 }, caption: txtmain }, | |
{ quoted: m } | |
); | |
break; | |
case "tiktokmp3": | |
await doReact("📥"); | |
require("../System/Tiktokscraper") | |
.Tiktok(args[0]) | |
.then((data) => { | |
Atlas.sendMessage( | |
m.from, | |
{ audio: { url: data.audio }, mimetype: "audio/mpeg" }, | |
{ quoted: m } | |
); | |
}); | |
break; | |
case "tiktokmp4": | |
await doReact("📥"); | |
require("../System/Tiktokscraper") | |
.Tiktok(args[0]) | |
.then((data) => { | |
Atlas.sendMessage( | |
m.from, | |
{ | |
video: { url: data.watermark }, | |
caption: `Downloaded by: *${botName}*`, | |
}, | |
{ quoted: m } | |
); | |
}); | |
break; | |
case "tiktokdoc": | |
await doReact("📥"); | |
require("../System/Tiktokscraper") | |
.Tiktok(args[0]) | |
.then((data) => { | |
Atlas.sendMessage( | |
m.from, | |
{ | |
document: { url: data.audio }, | |
mimetype: "audio/mpeg", | |
fileName: `Downloaded by ${botName}.mp3`, | |
}, | |
{ quoted: m } | |
); | |
}); | |
break; | |
default: | |
break; | |
} | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.githubusercontent.com/FantoX/2de67bc72021805417cbd317385ea71a/raw/f70879fc861dadd440f4a4a7dbb01cdae44b3c56/tiktokdl.js