Skip to main content
Module

x/serpapi/mod.ts>getHtml

Scrape and parse search engine results using SerpApi.
Latest
function getHtml
import { getHtml } from "https://deno.land/x/serpapi@2.1.0/mod.ts";

Get raw HTML response based on search parameters.

Examples

// async/await const html = await getHtml({ engine: "google", api_key: API_KEY, q: "coffee" });

// callback getHtml({ engine: "google", api_key: API_KEY, q: "coffee" }, console.log);

Parameters

parameters: EngineParameters

Search query parameters for the engine. Refer to https://serpapi.com/search-api for parameter explanations.

optional
callback: (html: string) => void

Optional callback.

Returns

Promise<string>

Get raw HTML response based on search parameters.

Examples

// async/await const html = await getHtml({ engine: "google", api_key: API_KEY, q: "coffee" });

// callback getHtml({ engine: "google", api_key: API_KEY, q: "coffee" }, console.log);

Parameters

engine: string

Engine name. Refer to https://serpapi.com/search-api for valid engines.

parameters: EngineParameters

Search query parameters for the engine. Refer to https://serpapi.com/search-api for parameter explanations.

optional
callback: (html: string) => void

Optional callback.

Returns

Promise<string>