跳到主要内容

Function: fromURL()

fromURL(url, options): Promise<CheerioAPI>

fromURL loads a document from a URL.

By default, redirects are allowed and non-2xx responses are rejected.

Parameters

url: string | URL

The URL to load the document from.

options: CheerioRequestOptions = {}

The options to pass to Cheerio.

Returns

Promise<CheerioAPI>

The loaded document.

Example

import * as cheerio from 'cheerio';

const $ = await cheerio.fromURL('https://example.com');

Defined in

src/index.ts:215