浏览代码

chore: support multiple globs in config

86 1 年之前
父节点
当前提交
6f7748e60c
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      config.ts
  2. 1 1
      src/main.ts

+ 1 - 1
config.ts

@@ -3,7 +3,7 @@ type Config = {
   /** URL to start the crawl */
   url: string;
   /** Pattern to match against for links on a page to subsequently crawl */
-  match: string;
+  match: string | string[];
   /** Selector to grab the inner text from */
   selector: string;
   /** Don't crawl more than this many pages */

+ 1 - 1
src/main.ts

@@ -51,7 +51,7 @@ if (process.env.NO_CRAWL !== "true") {
       // Extract links from the current page
       // and add them to the crawling queue.
       await enqueueLinks({
-        globs: [config.match],
+        globs: typeof config.match === "string" ? [config.match] : config.match,
       });
     },
     // Comment this option to scrape the full website.