函数: fromURL()
fromURL(
url
,options
):Promise
<CheerioAPI
>
fromURL
从 URL 加载文档。
默认情况下,允许重定向,非 2xx 响应将被拒绝。
参数
• url: string
| URL
要从中加载文档的 URL。
• options: CheerioRequestOptions
= {}
传递给 Cheerio 的选项。
返回值
已加载的文档。
示例
import * as cheerio from 'cheerio';
const $ = await cheerio.fromURL('https://example.com');