UNPKG

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

46 lines (38 loc) 1.17 kB
async function likeedl(url) { const fetch = require('node-fetch'); const { JSDOM } = require('jsdom'); const apiUrl = 'https://likeedownloader.com/process'; const formData = new URLSearchParams(); formData.append('id', url); formData.append('locale', 'en'); const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-Requested-With': 'XMLHttpRequest' }, body: formData }); const rawText = await response.text(); const cleanText = rawText.replace(/^\ufeff/, '').trim(); let data; try { data = JSON.parse(cleanText); } catch (err) { throw new Error(`Failed to parse JSON: ${err.message}`); } const dom = new JSDOM(data.template); const document = dom.window.document; const wm = document.querySelector('.with_watermark')?.getAttribute('href'); const no_wm = document.querySelector('.without_watermark')?.getAttribute('href'); return { author: "Herza", status: 200, data: { wm, no_wm } }; } module.exports = { likeedl}