Update index.js
Browse files9 unmodified lines1011121314151616 unmodified lines333435363738394041424344454639 unmodified lines8687888990919293949596979899100101102103104105106107108109379 unmodified lines489490491465492493494495496470497498499500501475502503504505506480507508509510511485512513514515516490517518519520521495522523524525526500527528529530531532533534535536505537538539540541510542543544545546547548105 unmodified lines6546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836849 unmodified linesconst os = require('os')const cheerio = require('cheerio')const cloudscraper = require('cloudscraper')const { acr } = require("acrcloud"); const { File } = require('megajs')const { BingChat } = require("bing-chat-cjs-rnz");let fetch;16 unmodified lines return response;};
// isURLfunction isUrl(url) { let regex = new RegExp(/(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,9}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/, 'gi'); if (!regex.test(url)) return false; return url?.match(regex);}
//RANDOM function generateRandomUserAgent() { const androidVersions = ['4.0.3', '4.1.1', '4.2.2', '4.3', '4.4', '5.0.2', '5.1', '6.0', '7.0', '8.0', '9.0', '10.0', '11.0', '12.0', '13.0'];39 unmodified linesconst res = await api.sendMessage(text, { variant: 'Precise' })return res?.text}
async function acrCloud(buffer) { let { mime } = await (await import('file-type')).fileTypeFromBuffer(buffer); if (/audio|video/.test(mime)) { const wow = new acr({ host: "identify-ap-southeast-1.acrcloud.com", access_key: "b1cc283b4fb72483ebb6ea9c53512331", access_secret: "xyqJGTZRTrUotaraHEjji00WBClx7RpWozywdANq" }); let { status, metadata } = await wow.identify(buffer); if (status.code !== 0) throw new Error(status.msg); //console.log(metadata.music[0]) return metadata.music[0]; } else { throw new Error('Error: only audio/video files are supported'); }}
// MEDIAFIRE DLasync function mediafire(url) {379 unmodified lines { "title": "BING AI", "method": "GET", "example": `${host}/bing?q=` "example": "${host}/bing?q=" }, { "title": "Facebook Downloader", "method": "GET", "example": `${host}/fb?url=` "example": "${host}/fb?url=" }, { "title": "Instagram Downloader", "method": "GET", "example": `${host}/ig?url=` "example": "${host}/ig?url=" }, { "title": "Mediafire Downloader", "method": "GET", "example": `${host}/mediafire?url=` "example": "${host}/mediafire?url=" }, { "title": "Mega Downloader", "method": "GET", "example": `${host}/mega?url=`+ '${encodeURIComponent("url")}', "example": "${host}/mega?url="+ "${encodeURIComponent('url')}" }, { "title": "Pinterest Downloader", "method": "GET", "example": `${host}/pindl?url=` "example": "${host}/pindl?url=" }, { "title": "Tiktok Downloader", "method": "GET", "example": `${host}/tt?url=` "example": "${host}/tt?url=" }, { "title": "Twitter/X Downloader", "method": "GET", "example": `${host}/twitter?url=`, "example": "${host}/twitter?url=" }, { "title": "Whatmusic Search", "method": "GET", "example": "${host}/whatmusic?url=" }, { "title": "Youtube Downloader", "method": "GET", "example": `${host}/ytdl?url=` "example": "${host}/ytdl?url=" }, { "title": "Youtube Search", "method": "GET", "example": `${host}/ytsearch?q=` "example": "${host}/ytsearch?q=" }]
});});
105 unmodified lines console.log(e); return res.json({ message: e.message }); }})app.get('/whatmusic', async (req, res) => { try { let { url } = req.query async function downloadBuffer(url) { try { const response = await axios({ method: 'get', url: url, responseType: 'arraybuffer' }); return Buffer.from(response.data, 'binary'); } catch (error) { throw new Error(`Failed to download the file: ${error.message}`); } } if (!url) return res.json({ message: 'Input parameter url' }); if (!isUrl(url)) return res.json({ message: 'Invalit Input Link' }) let data = await acrCloud(await downloadBuffer(isUrl(url)[0])) if (!data) return res.json({ error: 'Error:v'}) return res.json(data); } catch (e) { console.log(e); return res.json({ message: e.message }); } }) app.get('/ytsearch', async (req, res) => { try {index.js+68-10