UNPKG

akiraa-scrape

Version:

Module & tools for bot whatsApp

23 lines (18 loc) 509 B
const fetch = require("node-fetch"); async function generateSerpApiUrl(data) { const params = new URLSearchParams(data); const url = `https://serpapi.com/search.json?${params.toString()}`; try { const response = await fetch(url); if (!response.ok) { throw new Error("Request failed"); } const result = await response.json(); return result; } catch (error) { throw new Error(`Failed to fetch data: ${error.message}`); } } module.exports = { generateSerpApiUrl, };