1 Star 0 Fork 1

Ryuuzaki1412/gpt-crawler

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
config.ts 1006 Bytes
一键复制 编辑 原始数据 按行查看 历史
86 提交于 2023-11-21 08:32 . chore: support multiple globs in config
import { Page } from "playwright";
type Config = {
/** URL to start the crawl */
url: string;
/** Pattern to match against for links on a page to subsequently crawl */
match: string | string[];
/** Selector to grab the inner text from */
selector: string;
/** Don't crawl more than this many pages */
maxPagesToCrawl: number;
/** File name for the finished data */
outputFileName: string;
/** Optional cookie to be set. E.g. for Cookie Consent */
cookie?: { name: string; value: string };
/** Optional function to run for each page found */
onVisitPage?: (options: {
page: Page;
pushData: (data: any) => Promise<void>;
}) => Promise<void>;
/** Optional timeout for waiting for a selector to appear */
waitForSelectorTimeout?: number;
};
export const config: Config = {
url: "https://www.builder.io/c/docs/developers",
match: "https://www.builder.io/c/docs/**",
selector: `.docs-builder-container`,
maxPagesToCrawl: 50,
outputFileName: "output.json",
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ryuuzaki1412/gpt-crawler.git
git@gitee.com:ryuuzaki1412/gpt-crawler.git
ryuuzaki1412
gpt-crawler
gpt-crawler
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385