Переглянути джерело

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.