소스 검색

Merge pull request #40 from 86/86/multiple-globs

chore: support multiple globs in config
Steve Sewell 1 년 전
부모
커밋
2b5a2b8da7
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.