goat
command
anisearch
Anime edits from TikTok
0
views
0
likes
0
installs
Aliases: anisr
raw source
const axios = require('axios');
const fs = require('fs-extra');
const path = require('path');
if (!global.instaMemory) global.instaMemory = new Set();
const TUTORIAL_KEYWORDS = [
"tutorial", "how to edit", "how to make", "how i edit", "how to create",
"cara edit", "cara buat", "cara membuat", "edit tutorial", "editing tutorial",
"step by step", "tuto edit", "tuto ", "learn how", "edit guide",
"guide to edit", "capcut tutorial", "alight motion tutorial",
"kaise edit", "edit kaise", "edit karna", "editing kaise", "coba edit",
"belajar edit", "trik edit", "tips edit", "preset tutorial"
];
function isTutorialVideo(video) {
const text = `${video.title || ""} ${video.desc || ""} ${video.description || ""}`.toLowerCase();
return TUTORIAL_KEYWORDS.some(kw => text.includes(kw));
}
module.exports = {
config: {
name: "anisearch",
aliases: ["anisr"],
version: "1.3.2",
author: "Arafat",
countDown: 5,
role: 0,
description: "Anime edits from TikTok",
category: "media",
guide: {
en: "{pn} [anime name]"
}
},
onStart: async function ({ api, event, args, message }) {
const query = args.join(" ");
if (!query) return message.reply(serifBold("๐๐ฅ๐๐๐ฌ๐ ๐ฉ๐ซ๐จ๐ฏ๐ข๐๐ ๐๐ง ๐๐ง๐ข๐ฆ๐ ๐ง๐๐ฆ๐! ๐ธ"));
api.setMessageReaction("โจ", event.messageID, () => {}, true);
const cacheDir = path.join(__dirname, 'cache');
if (!fs.existsSync(cacheDir)) fs.mkdirSync(cacheDir);
const pathVideo = path.join(cacheDir, `anisr_${Date.now()}.mp4`);
try {
const searchTerms = `${query} anime edit amv no watermark`;
const res = await axios.get(`https://azadx69x-tiktok-api.vercel.app/tiktok/search`, {
params: { query: searchTerms },
timeout: 15000
});
const rawVideos = res.data?.list;
if (!rawVideos || rawVideos.length === 0) {
api.setMessageReaction("โ", event.messageID, () => {}, true);
return message.reply(serifBold(""));
}
const videos = rawVideos.filter(v => !isTutorialVideo(v));
const getVideoId = (v) => v.video_id || v.id || v.url;
let selectedVideo = videos.find(v => !global.instaMemory.has(getVideoId(v)));
if (!selectedVideo) {
global.instaMemory.clear();
selectedVideo = videos[0];
}
global.instaMemory.add(getVideoId(selectedVideo));
const downloadUrl = selectedVideo.noWatermark || selectedVideo.play || selectedVideo.wmplay;
const videoResponse = await axios({
method: 'get',
url: downloadUrl,
responseType: 'arraybuffer',
timeout: 30000,
headers: { 'User-Agent': 'Mozilla/5.0' }
});
await fs.writeFile(pathVideo, Buffer.from(videoResponse.data));
await message.reply({
body: serifBold(`โข ๐๐๐ซ๐ ๐ข๐ฌ ๐ฒ๐จ๐ฎ๐ซ ๐ฏ๐ข๐๐๐จ ๐๐๐๐ฒ <๐`),
attachment: fs.createReadStream(pathVideo)
});
api.setMessageReaction("๐ธ", event.messageID, () => {}, true);
} catch (err) {
console.error("DEBUG ERROR:", err.message);
api.setMessageReaction("โ ๏ธ", event.messageID, () => {}, true);
const errorMsg = err.code === 'ECONNABORTED'
? "โ ๏ธ | ๐๐จ๐ง๐ง๐๐๐ญ๐ข๐จ๐ง ๐ญ๐ข๐ฆ๐๐ ๐จ๐ฎ๐ญ. ๐๐ซ๐ฒ ๐๐ ๐๐ข๐ง!"
: "โ ๏ธ | ๐๐๐ซ๐ฏ๐๐ซ ๐ข๐ฌ ๐๐ฎ๐ฌ๐ฒ ๐จ๐ซ ๐๐๐ ๐ข๐ฌ ๐๐จ๐ฐ๐ง. ๐๐ซ๐ฒ ๐๐ ๐๐ข๐ง!";
return message.reply(serifBold(errorMsg));
} finally {
if (fs.existsSync(pathVideo)) {
setTimeout(() => {
try { fs.unlinkSync(pathVideo); } catch(e) {}
}, 20000);
}
}
}
};
function serifBold(text) {
const letters = {
'a': '๐', 'b': '๐', 'c': '๐', 'd': '๐', 'e': '๐', 'f': '๐', 'g': '๐ ', 'h': '๐ก', 'i': '๐ข', 'j': '๐ฃ', 'k': '๐ค', 'l': '๐ฅ', 'm': '๐ฆ',
'n': '๐ง', 'o': '๐จ', 'p': '๐ฉ', 'q': '๐ช', 'r': '๐ซ', 's': '๐ฌ', 't': '๐ญ', 'u': '๐ฎ', 'v': '๐ฏ', 'w': '๐ฐ', 'x': '๐ฑ', 'y': '๐ฒ', 'z': '๐ณ',
'A': '๐', 'B': '๐', 'C': '๐', 'D': '๐', 'E': '๐', 'F': '๐
', 'G': '๐', 'H': '๐', 'I': '๐', 'J': '๐', 'K': '๐', 'L': '๐', 'M': '๐',
'N': '๐', 'O': '๐', 'P': '๐', 'Q': '๐', 'R': '๐', 'S': '๐', 'T': '๐', 'U': '๐', 'V': '๐', 'W': '๐', 'X': '๐', 'Y': '๐', 'Z': '๐',
'0': '๐', '1': '๐', '2': '๐', '3': '๐', '4': '๐', '5': '๐', '6': '๐', '7': '๐', '8': '๐', '9': '๐'
};
return text.split('').map(char => letters[char] || char).join('');
}