Skip to content

Instantly share code, notes, and snippets.

@Reyz2902
Created December 12, 2025 14:20
Show Gist options
  • Select an option

  • Save Reyz2902/4e58f9c9e15aedbd6e96fc9198034dd2 to your computer and use it in GitHub Desktop.

Select an option

Save Reyz2902/4e58f9c9e15aedbd6e96fc9198034dd2 to your computer and use it in GitHub Desktop.
Uploaded via Theresa
const axios = require('axios');
const handler = async (m, {
conn,
args,
usedPrefix,
command
}) => {
if (!args[0]) {
return m.reply(`Usage: ${usedPrefix + command} <tiktok_url>`);
}
const url = args[0];
if (!/(?:tiktok\.com|vt\.tiktok\.com)/.test(url)) {
return m.reply('Please provide a valid TikTok URL.');
}
try {
await conn.sendMessage(m.chat, {
react: {
text: 'πŸ•’',
key: m.key,
}
});
const apiResponse = await axios.get(`https://theresapis.vercel.app/download/tiktok?url=${encodeURIComponent(url)}`);
const {
data
} = apiResponse;
if (!data.status || data.result.code !== 0) {
throw new Error(data.result.msg || 'Failed to download TikTok content.');
}
const result = data.result.data;
let caption = `
*Title:* ${result.title}
*Author:* ${result.author.nickname} (@${result.author.unique_id})
❀️ *Likes:* ${result.digg_count.toLocaleString()}
πŸ’¬ *Comments:* ${result.comment_count.toLocaleString()}
πŸ”— *Shares:* ${result.share_count.toLocaleString()}
πŸ‘οΈ *Views:* ${result.play_count.toLocaleString()}
`.trim();
if (result.images && result.images.length > 0) {
// Handle slideshow/images
m.reply(caption);
for (let i = 0; i < result.images.length; i++) {
await conn.sendFile(m.chat, result.images[i], `tiktok_image_${i + 1}.jpeg`, '', m, false, {
asDocument: false
});
}
} else if (result.play) {
// Handle video
await conn.sendFile(m.chat, result.play, 'tiktok.mp4', caption, m);
} else {
throw new Error('No downloadable media found in the response.');
}
await conn.sendMessage(m.chat, {
react: {
text: 'βœ…',
key: m.key,
}
});
} catch (error) {
console.error('TikTok Download Error:', error);
await conn.sendMessage(m.chat, {
react: {
text: '❌',
key: m.key,
}
});
m.reply(`An error occurred: ${error.message || 'Unable to process your request.'}`);
}
};
handler.help = ['tiktok <url>'];
handler.tags = ['downloader'];
handler.command = /^(tiktok|tt|ttdl|tiktokdl)$/i;
handler.description = 'Download TikTok videos or image slideshows without watermark.';
module.exports = handler;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment