put notes/040fce73-fa0c-4b3d-a204-12f528abad05.json
Browse files
notes/040fce73-fa0c-4b3d-a204-12f528abad05.json
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"id": "040fce73-fa0c-4b3d-a204-12f528abad05",
|
3 |
+
"title": "atd.js",
|
4 |
+
"content": "const axios = require(\"axios\");\n\nmodule.exports.config = {\n name: \"Downlink\",\n version: \"2.1.0\",\n hasPermssion: 0,\n credits: \"gấu lỏ\",\n description: \"Tải video/ảnh từ các nền tảng\",\n commandCategory: \"Tiện ích\",\n usages: \"Tự động hoạt động khi có link\",\n cooldowns: 5\n};\n\nmodule.exports.run = async function () { };\n\nmodule.exports.handleEvent = async function ({ api, event }) {\n const { threadID, messageID, body } = event;\n if (!body) return;\n\n const urls = body.match(/https?:\\/\\/[\\w\\d\\-._~:/?#[\\]@!$&'()*+,;=%]+/g);\n if (!urls) return;\n const url = urls[0];\n\n const supported = [\n \"facebook.com\", \"tiktok.com\", \"douyin.com\",\n \"instagram.com\", \"threads.net\", \"youtube.com\",\n \"youtu.be\", \"capcut.com\", \"threads.com\"\n ];\n if (!supported.some(domain => url.includes(domain))) return;\n\n try {\n const response = await axios.post(\n \"https://downr.org/.netlify/functions/download\",\n { url },\n {\n headers: {\n \"accept\": \"*/*\",\n \"content-type\": \"application/json\",\n \"origin\": \"https://downr.org\",\n \"referer\": \"https://downr.org/\",\n \"user-agent\": \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36\"\n }\n }\n );\n\n const data = response.data;\n if (!data || !Array.isArray(data.medias)) return;\n\n const title = data.title || \"Không có tiêu đề\";\n const author = data.author || \"Không rõ\";\n const header = `[${(data.source || \"Unknown\").toUpperCase()}] - Tự Động Tải\\n\\n👤 Tác giả: ${author}\\n💬 Tiêu đề: ${title}`;\n const videoList = data.medias.filter(m => m.type === \"video\");\n let bestVideo = null;\n if (videoList.length > 0) {\n bestVideo =\n videoList.find(v => v.quality === \"hd_no_watermark\") ||\n videoList.find(v => v.quality === \"no_watermark\") ||\n videoList[0];\n }\n const images = data.medias.filter(m => m.type === \"image\").map(img => img.url);\n const attachments = [];\n for (const imgUrl of images) {\n const imgStream = (await axios.get(imgUrl, { responseType: \"stream\" })).data;\n attachments.push(imgStream);\n }\n if (bestVideo) {\n const videoStream = (await axios.get(bestVideo.url, { responseType: \"stream\" })).data;\n attachments.push(videoStream);\n }\n\n if (attachments.length) {\n await api.sendMessage({\n body: header,\n attachment: attachments\n }, threadID, messageID);\n }\n\n } catch (err) {\n console.error(\"❌ Lỗi tải media:\", err.message || err);\n }\n};",
|
5 |
+
"language": "javascript",
|
6 |
+
"createdAt": 1755696940500,
|
7 |
+
"updatedAt": 1755696940500
|
8 |
+
}
|