@crawlee/utils 4.0.0-beta.110 → 4.0.0-beta.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,10 +1,8 @@
1
- export * from './internals/blocked.js';
2
- export * from './internals/cheerio.js';
3
- export * from './internals/extract-urls.js';
4
- export * from './internals/general.js';
1
+ export { htmlToText } from './internals/cheerio.js';
2
+ export { downloadListOfUrls, extractUrls } from './internals/extract-urls.js';
3
+ export type { DownloadListOfUrlsOptions, ExtractUrlsOptions } from './internals/extract-urls.js';
4
+ export { sleep, expandShadowRoots } from './internals/general.js';
5
5
  export * as social from './internals/social.js';
6
6
  export * from './internals/open_graph_parser.js';
7
7
  export * from './internals/robots.js';
8
8
  export * from './internals/sitemap.js';
9
- export * from './internals/iterables.js';
10
- export * from './internals/url.js';
package/index.js CHANGED
@@ -1,10 +1,7 @@
1
- export * from './internals/blocked.js';
2
- export * from './internals/cheerio.js';
3
- export * from './internals/extract-urls.js';
4
- export * from './internals/general.js';
1
+ export { htmlToText } from './internals/cheerio.js';
2
+ export { downloadListOfUrls, extractUrls } from './internals/extract-urls.js';
3
+ export { sleep, expandShadowRoots } from './internals/general.js';
5
4
  export * as social from './internals/social.js';
6
5
  export * from './internals/open_graph_parser.js';
7
6
  export * from './internals/robots.js';
8
7
  export * from './internals/sitemap.js';
9
- export * from './internals/iterables.js';
10
- export * from './internals/url.js';
package/internal.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from './internals/blocked.js';
2
+ export type { CheerioRoot, CheerioAPI, Cheerio, Element } from './internals/cheerio.js';
3
+ export { extractUrlsFromCheerio } from './internals/cheerio.js';
4
+ export { tryAbsoluteURL } from './internals/extract-urls.js';
5
+ export { URL_NO_COMMAS_REGEX, URL_WITH_COMMAS_REGEX } from './internals/general.js';
6
+ export * from './internals/iterables.js';
7
+ export * from './internals/url.js';
package/internal.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from './internals/blocked.js';
2
+ export { extractUrlsFromCheerio } from './internals/cheerio.js';
3
+ export { tryAbsoluteURL } from './internals/extract-urls.js';
4
+ export { URL_NO_COMMAS_REGEX, URL_WITH_COMMAS_REGEX } from './internals/general.js';
5
+ export * from './internals/iterables.js';
6
+ export * from './internals/url.js';
@@ -44,6 +44,11 @@ export declare class RobotsTxtFile {
44
44
  */
45
45
  static from(url: string, content: string, proxyUrl?: string): RobotsTxtFile;
46
46
  private static load;
47
+ /**
48
+ * Get crawl delay for a given user agent.
49
+ * @param [userAgent] relevant user agent, default to `*`
50
+ */
51
+ getCrawlDelay(userAgent?: string): number | undefined;
47
52
  /**
48
53
  * Check if a URL should be crawled by robots.
49
54
  * @param url the URL to check against the rules in robots.txt
@@ -70,11 +70,21 @@ export class RobotsTxtFile {
70
70
  getSitemaps() {
71
71
  return [];
72
72
  },
73
+ getCrawlDelay() {
74
+ return undefined;
75
+ },
73
76
  }, proxyUrl, logger);
74
77
  }
75
78
  // @ts-ignore
76
79
  return new RobotsTxtFile(robotsParser(url.toString(), await response.text()), proxyUrl, logger);
77
80
  }
81
+ /**
82
+ * Get crawl delay for a given user agent.
83
+ * @param [userAgent] relevant user agent, default to `*`
84
+ */
85
+ getCrawlDelay(userAgent = '*') {
86
+ return this.#robots.getCrawlDelay(userAgent);
87
+ }
78
88
  /**
79
89
  * Check if a URL should be crawled by robots.
80
90
  * @param url the URL to check against the rules in robots.txt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/utils",
3
- "version": "4.0.0-beta.110",
3
+ "version": "4.0.0-beta.112",
4
4
  "description": "A set of shared utilities that can be used by crawlers",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -8,6 +8,7 @@
8
8
  "type": "module",
9
9
  "exports": {
10
10
  ".": "./index.js",
11
+ "./internal": "./internal.js",
11
12
  "./package.json": "./package.json"
12
13
  },
13
14
  "keywords": [
@@ -42,8 +43,8 @@
42
43
  },
43
44
  "dependencies": {
44
45
  "@apify/ps-tree": "^1.2.0",
45
- "@crawlee/http-client": "4.0.0-beta.110",
46
- "@crawlee/types": "4.0.0-beta.110",
46
+ "@crawlee/http-client": "4.0.0-beta.112",
47
+ "@crawlee/types": "4.0.0-beta.112",
47
48
  "@types/sax": "^1.2.7",
48
49
  "cheerio": "^1.0.0",
49
50
  "domhandler": "^5.0.3",
@@ -61,5 +62,5 @@
61
62
  }
62
63
  }
63
64
  },
64
- "gitHead": "71f42c48f431ca46b04491eca65b191691e75033"
65
+ "gitHead": "5d1e107d4dc4ffd21f1c6cc5b1a1c10b59ca2b47"
65
66
  }