notmebotz-tools
Version:
Sebuah Tools yang berfungsi untuk mendownload Video atau Foto dari media sosial, serta sebagai tools yang berguna untuk aplikasi kamu seperti untuk BOT
33 lines (30 loc) • 955 B
JavaScript
const cheerio = require('cheerio')
const axios = require('axios')
async function snackvid(url) {
const baseURL = `https://www.expertstool.com/d.php?url=${url}`
try {
const { data } = await axios.get(baseURL)
const $ = cheerio.load(data)
const videoUrl = $('video source').attr('src')
const imageUrl = $('img[style*="width: 100%"]').attr('src')
const videoDownloadUrl = $('a[title="Right Click and Save to start Downloading"]').attr('href')
const imageDownloadUrl = $('a[download][title="Right Click and Save to start Downloading"]').attr('href')
return {
author: "Herza",
status: 200,
data: {
video: {
url: videoUrl,
downloadUrl: videoDownloadUrl
},
image: {
url: imageUrl,
downloadUrl: imageDownloadUrl
}
}
}
} catch (error) {
throw new Error(`Failed to fetch Snack video: ${error.message}`)
}
}
module.exports = { snackvid}