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
31 lines (28 loc) • 1.08 kB
JavaScript
/**
* @author : Roidev~404~
* @Channel : https://whatsapp.com/channel/0029VagADOLLSmbaxFNswH1m
* @name : RedNote(Xiaohongshu) Downloader
* @module : CommonJS Module
* Bebas tempel jangan copot we em-nya 🙇
*/
const axios = require("axios");
const cheerio = require("cheerio");
const xhs = async (link) => {
const id = link.match(/\/a\/([^?\/]+)/);
const response = await axios.get(`http://xhslink.com/a/${id[1]}`, {
headers: {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"
}
});
const skrep = cheerio.load(response.data);
const title = skrep('head meta[name="og:title"]').attr('content');
const downloadUrl = skrep('head meta[name="og:video"]').attr('content');
return {
author: "Herza",
status: 200,
data:
title,
downloadUrl };
};
module.exports = { xhs }