@dealcrawl/sdk 2.1.1 → 2.2.0

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.
Files changed (85) hide show
  1. package/README.md +147 -14
  2. package/dist/index.d.mts +2769 -0
  3. package/dist/index.d.ts +2748 -37
  4. package/dist/index.js +2529 -64
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +2508 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +14 -7
  9. package/dist/client.d.ts +0 -285
  10. package/dist/client.d.ts.map +0 -1
  11. package/dist/client.js +0 -336
  12. package/dist/client.js.map +0 -1
  13. package/dist/error.d.ts +0 -55
  14. package/dist/error.d.ts.map +0 -1
  15. package/dist/error.js +0 -128
  16. package/dist/error.js.map +0 -1
  17. package/dist/index.d.ts.map +0 -1
  18. package/dist/resources/account.d.ts +0 -143
  19. package/dist/resources/account.d.ts.map +0 -1
  20. package/dist/resources/account.js +0 -186
  21. package/dist/resources/account.js.map +0 -1
  22. package/dist/resources/crawl.d.ts +0 -101
  23. package/dist/resources/crawl.d.ts.map +0 -1
  24. package/dist/resources/crawl.js +0 -234
  25. package/dist/resources/crawl.js.map +0 -1
  26. package/dist/resources/data.d.ts +0 -157
  27. package/dist/resources/data.d.ts.map +0 -1
  28. package/dist/resources/data.js +0 -245
  29. package/dist/resources/data.js.map +0 -1
  30. package/dist/resources/dork.d.ts +0 -104
  31. package/dist/resources/dork.d.ts.map +0 -1
  32. package/dist/resources/dork.js +0 -163
  33. package/dist/resources/dork.js.map +0 -1
  34. package/dist/resources/extract.d.ts +0 -105
  35. package/dist/resources/extract.d.ts.map +0 -1
  36. package/dist/resources/extract.js +0 -246
  37. package/dist/resources/extract.js.map +0 -1
  38. package/dist/resources/index.d.ts +0 -14
  39. package/dist/resources/index.d.ts.map +0 -1
  40. package/dist/resources/index.js +0 -14
  41. package/dist/resources/index.js.map +0 -1
  42. package/dist/resources/keys.d.ts +0 -124
  43. package/dist/resources/keys.d.ts.map +0 -1
  44. package/dist/resources/keys.js +0 -168
  45. package/dist/resources/keys.js.map +0 -1
  46. package/dist/resources/scrape.d.ts +0 -53
  47. package/dist/resources/scrape.d.ts.map +0 -1
  48. package/dist/resources/scrape.js +0 -85
  49. package/dist/resources/scrape.js.map +0 -1
  50. package/dist/resources/status.d.ts +0 -100
  51. package/dist/resources/status.d.ts.map +0 -1
  52. package/dist/resources/status.js +0 -133
  53. package/dist/resources/status.js.map +0 -1
  54. package/dist/resources/webhooks.d.ts +0 -126
  55. package/dist/resources/webhooks.d.ts.map +0 -1
  56. package/dist/resources/webhooks.js +0 -167
  57. package/dist/resources/webhooks.js.map +0 -1
  58. package/dist/types/config.d.ts +0 -45
  59. package/dist/types/config.d.ts.map +0 -1
  60. package/dist/types/config.js +0 -10
  61. package/dist/types/config.js.map +0 -1
  62. package/dist/types/index.d.ts +0 -8
  63. package/dist/types/index.d.ts.map +0 -1
  64. package/dist/types/index.js +0 -8
  65. package/dist/types/index.js.map +0 -1
  66. package/dist/types/options.d.ts +0 -328
  67. package/dist/types/options.d.ts.map +0 -1
  68. package/dist/types/options.js +0 -6
  69. package/dist/types/options.js.map +0 -1
  70. package/dist/types/responses.d.ts +0 -422
  71. package/dist/types/responses.d.ts.map +0 -1
  72. package/dist/types/responses.js +0 -6
  73. package/dist/types/responses.js.map +0 -1
  74. package/dist/types/shared.d.ts +0 -234
  75. package/dist/types/shared.d.ts.map +0 -1
  76. package/dist/types/shared.js +0 -37
  77. package/dist/types/shared.js.map +0 -1
  78. package/dist/utils/polling.d.ts +0 -57
  79. package/dist/utils/polling.d.ts.map +0 -1
  80. package/dist/utils/polling.js +0 -110
  81. package/dist/utils/polling.js.map +0 -1
  82. package/dist/utils/request.d.ts +0 -47
  83. package/dist/utils/request.d.ts.map +0 -1
  84. package/dist/utils/request.js +0 -192
  85. package/dist/utils/request.js.map +0 -1
@@ -1,104 +0,0 @@
1
- /**
2
- * Dork Resource
3
- * Handles Google Dork search operations
4
- */
5
- import type { RequestContext } from "../types/config";
6
- import type { DorkOptions } from "../types/options";
7
- import type { DorkJobResponse } from "../types/responses";
8
- /**
9
- * Dork resource class
10
- * Provides methods for Google Dork searches
11
- */
12
- export declare class DorkResource {
13
- private ctx;
14
- constructor(ctx: RequestContext);
15
- /**
16
- * Create a new dork search job
17
- *
18
- * @example
19
- * ```ts
20
- * const job = await client.dork.create({
21
- * query: "discount coupon",
22
- * site: "amazon.com",
23
- * maxResults: 20
24
- * });
25
- * console.log(job.jobId);
26
- * ```
27
- */
28
- create(options: DorkOptions): Promise<DorkJobResponse>;
29
- /**
30
- * Search for deals on a specific site
31
- * Convenience method for finding discount pages
32
- *
33
- * @example
34
- * ```ts
35
- * const job = await client.dork.findDeals("amazon.com", {
36
- * maxResults: 50
37
- * });
38
- * ```
39
- */
40
- findDeals(site: string, options?: Omit<DorkOptions, "query" | "site">): Promise<DorkJobResponse>;
41
- /**
42
- * Search for product pages on a site
43
- * Looks for common product URL patterns
44
- *
45
- * @example
46
- * ```ts
47
- * const job = await client.dork.findProducts("shop.example.com", {
48
- * maxResults: 100
49
- * });
50
- * ```
51
- */
52
- findProducts(site: string, options?: Omit<DorkOptions, "query" | "site" | "inUrl">): Promise<DorkJobResponse>;
53
- /**
54
- * Search for PDFs on a site
55
- * Useful for finding manuals, guides, datasheets
56
- *
57
- * @example
58
- * ```ts
59
- * const job = await client.dork.findPDFs("docs.example.com", "user guide");
60
- * ```
61
- */
62
- findPDFs(site: string, query?: string, options?: Omit<DorkOptions, "query" | "site" | "fileType">): Promise<DorkJobResponse>;
63
- /**
64
- * Search with custom title filter
65
- * Find pages with specific terms in title
66
- *
67
- * @example
68
- * ```ts
69
- * const job = await client.dork.inTitle("Black Friday", {
70
- * site: "bestbuy.com",
71
- * maxResults: 30
72
- * });
73
- * ```
74
- */
75
- inTitle(titleQuery: string, options?: Omit<DorkOptions, "inTitle">): Promise<DorkJobResponse>;
76
- /**
77
- * Search with custom URL filter
78
- * Find pages with specific terms in URL
79
- *
80
- * @example
81
- * ```ts
82
- * const job = await client.dork.inUrl("clearance", {
83
- * site: "walmart.com"
84
- * });
85
- * ```
86
- */
87
- inUrl(urlQuery: string, options?: Omit<DorkOptions, "inUrl">): Promise<DorkJobResponse>;
88
- /**
89
- * Build a raw Google dork query string
90
- * Useful for preview or debugging
91
- *
92
- * @example
93
- * ```ts
94
- * const query = client.dork.buildQuery({
95
- * query: "laptop deals",
96
- * site: "amazon.com",
97
- * inTitle: "discount"
98
- * });
99
- * // Returns: "laptop deals site:amazon.com intitle:discount"
100
- * ```
101
- */
102
- buildQuery(options: DorkOptions): string;
103
- }
104
- //# sourceMappingURL=dork.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dork.d.ts","sourceRoot":"","sources":["../../src/resources/dork.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D;;;GAGG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,cAAc;IAEvC;;;;;;;;;;;;OAYG;IACG,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAW5D;;;;;;;;;;OAUG;IACG,SAAS,CACb,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC,GAC5C,OAAO,CAAC,eAAe,CAAC;IAQ3B;;;;;;;;;;OAUG;IACG,YAAY,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,GACtD,OAAO,CAAC,eAAe,CAAC;IAS3B;;;;;;;;OAQG;IACG,QAAQ,CACZ,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC,GACzD,OAAO,CAAC,eAAe,CAAC;IAS3B;;;;;;;;;;;OAWG;IACG,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GACrC,OAAO,CAAC,eAAe,CAAC;IAQ3B;;;;;;;;;;OAUG;IACG,KAAK,CACT,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,eAAe,CAAC;IAQ3B;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM;CAuBzC"}
@@ -1,163 +0,0 @@
1
- /**
2
- * Dork Resource
3
- * Handles Google Dork search operations
4
- */
5
- import { post } from "../utils/request";
6
- /**
7
- * Dork resource class
8
- * Provides methods for Google Dork searches
9
- */
10
- export class DorkResource {
11
- ctx;
12
- constructor(ctx) {
13
- this.ctx = ctx;
14
- }
15
- /**
16
- * Create a new dork search job
17
- *
18
- * @example
19
- * ```ts
20
- * const job = await client.dork.create({
21
- * query: "discount coupon",
22
- * site: "amazon.com",
23
- * maxResults: 20
24
- * });
25
- * console.log(job.jobId);
26
- * ```
27
- */
28
- async create(options) {
29
- const body = {
30
- query: this.buildQuery(options),
31
- maxResults: options.maxResults,
32
- region: options.region,
33
- };
34
- const result = await post(this.ctx, "/v1/dork", body);
35
- return result.data;
36
- }
37
- /**
38
- * Search for deals on a specific site
39
- * Convenience method for finding discount pages
40
- *
41
- * @example
42
- * ```ts
43
- * const job = await client.dork.findDeals("amazon.com", {
44
- * maxResults: 50
45
- * });
46
- * ```
47
- */
48
- async findDeals(site, options) {
49
- return this.create({
50
- query: "discount OR coupon OR sale OR promo OR deal",
51
- site,
52
- ...options,
53
- });
54
- }
55
- /**
56
- * Search for product pages on a site
57
- * Looks for common product URL patterns
58
- *
59
- * @example
60
- * ```ts
61
- * const job = await client.dork.findProducts("shop.example.com", {
62
- * maxResults: 100
63
- * });
64
- * ```
65
- */
66
- async findProducts(site, options) {
67
- return this.create({
68
- query: "product OR item OR buy",
69
- site,
70
- inUrl: "product",
71
- ...options,
72
- });
73
- }
74
- /**
75
- * Search for PDFs on a site
76
- * Useful for finding manuals, guides, datasheets
77
- *
78
- * @example
79
- * ```ts
80
- * const job = await client.dork.findPDFs("docs.example.com", "user guide");
81
- * ```
82
- */
83
- async findPDFs(site, query, options) {
84
- return this.create({
85
- query: query || "*",
86
- site,
87
- fileType: "pdf",
88
- ...options,
89
- });
90
- }
91
- /**
92
- * Search with custom title filter
93
- * Find pages with specific terms in title
94
- *
95
- * @example
96
- * ```ts
97
- * const job = await client.dork.inTitle("Black Friday", {
98
- * site: "bestbuy.com",
99
- * maxResults: 30
100
- * });
101
- * ```
102
- */
103
- async inTitle(titleQuery, options) {
104
- return this.create({
105
- query: options?.query || titleQuery,
106
- inTitle: titleQuery,
107
- ...options,
108
- });
109
- }
110
- /**
111
- * Search with custom URL filter
112
- * Find pages with specific terms in URL
113
- *
114
- * @example
115
- * ```ts
116
- * const job = await client.dork.inUrl("clearance", {
117
- * site: "walmart.com"
118
- * });
119
- * ```
120
- */
121
- async inUrl(urlQuery, options) {
122
- return this.create({
123
- query: options?.query || urlQuery,
124
- inUrl: urlQuery,
125
- ...options,
126
- });
127
- }
128
- /**
129
- * Build a raw Google dork query string
130
- * Useful for preview or debugging
131
- *
132
- * @example
133
- * ```ts
134
- * const query = client.dork.buildQuery({
135
- * query: "laptop deals",
136
- * site: "amazon.com",
137
- * inTitle: "discount"
138
- * });
139
- * // Returns: "laptop deals site:amazon.com intitle:discount"
140
- * ```
141
- */
142
- buildQuery(options) {
143
- const parts = [];
144
- // Only add query if it's a non-empty string
145
- if (typeof options.query === 'string' && options.query.trim() !== '') {
146
- parts.push(options.query);
147
- }
148
- if (options.site) {
149
- parts.push(`site:${options.site}`);
150
- }
151
- if (options.fileType) {
152
- parts.push(`filetype:${options.fileType}`);
153
- }
154
- if (options.inUrl) {
155
- parts.push(`inurl:${options.inUrl}`);
156
- }
157
- if (options.inTitle) {
158
- parts.push(`intitle:${options.inTitle}`);
159
- }
160
- return parts.join(" ");
161
- }
162
- }
163
- //# sourceMappingURL=dork.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dork.js","sourceRoot":"","sources":["../../src/resources/dork.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;GAGG;AACH,MAAM,OAAO,YAAY;IACH;IAApB,YAAoB,GAAmB;QAAnB,QAAG,GAAH,GAAG,CAAgB;IAAG,CAAC;IAE3C;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,MAAM,CAAC,OAAoB;QAC/B,MAAM,IAAI,GAAG;YACX,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YAC/B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAkB,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,SAAS,CACb,IAAY,EACZ,OAA6C;QAE7C,OAAO,IAAI,CAAC,MAAM,CAAC;YACjB,KAAK,EAAE,6CAA6C;YACpD,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,YAAY,CAChB,IAAY,EACZ,OAAuD;QAEvD,OAAO,IAAI,CAAC,MAAM,CAAC;YACjB,KAAK,EAAE,wBAAwB;YA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B,KAAK,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,KAAK,CAAC,IAAI,CAAC,WAAW,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3C,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CACF"}
@@ -1,105 +0,0 @@
1
- /**
2
- * Extract Resource
3
- * Handles LLM-based structured data extraction
4
- */
5
- import type { RequestContext } from "../types/config";
6
- import type { ExtractOptions } from "../types/options";
7
- import type { ExtractJobResponse } from "../types/responses";
8
- /**
9
- * Extract resource class
10
- * Provides methods for structured data extraction using LLMs
11
- */
12
- export declare class ExtractResource {
13
- private ctx;
14
- constructor(ctx: RequestContext);
15
- /**
16
- * Create a new extraction job
17
- * Either schema or prompt must be provided
18
- *
19
- * @example
20
- * ```ts
21
- * // Schema-based extraction
22
- * const job = await client.extract.create({
23
- * url: "https://example.com/product",
24
- * schema: {
25
- * type: "object",
26
- * properties: {
27
- * name: { type: "string" },
28
- * price: { type: "number" },
29
- * features: { type: "array", items: { type: "string" } }
30
- * }
31
- * }
32
- * });
33
- *
34
- * // Prompt-based extraction
35
- * const job = await client.extract.create({
36
- * url: "https://example.com/article",
37
- * prompt: "Extract the main points and author name"
38
- * });
39
- * ```
40
- */
41
- create(options: ExtractOptions): Promise<ExtractJobResponse>;
42
- /**
43
- * Extract data using a JSON Schema
44
- * Convenience method for schema-based extraction
45
- *
46
- * @example
47
- * ```ts
48
- * const job = await client.extract.withSchema(
49
- * "https://example.com/product",
50
- * {
51
- * type: "object",
52
- * properties: {
53
- * name: { type: "string" },
54
- * price: { type: "number" }
55
- * }
56
- * }
57
- * );
58
- * ```
59
- */
60
- withSchema(url: string, schema: Record<string, unknown>, options?: Omit<ExtractOptions, "url" | "schema" | "prompt">): Promise<ExtractJobResponse>;
61
- /**
62
- * Extract data using a natural language prompt
63
- * Convenience method for prompt-based extraction
64
- *
65
- * @example
66
- * ```ts
67
- * const job = await client.extract.withPrompt(
68
- * "https://example.com/article",
69
- * "Extract the article title, author, publication date, and a brief summary"
70
- * );
71
- * ```
72
- */
73
- withPrompt(url: string, prompt: string, options?: Omit<ExtractOptions, "url" | "schema" | "prompt">): Promise<ExtractJobResponse>;
74
- /**
75
- * Extract product information from a page
76
- * Pre-built schema for common e-commerce use case
77
- *
78
- * @example
79
- * ```ts
80
- * const job = await client.extract.product("https://shop.example.com/item");
81
- * ```
82
- */
83
- product(url: string, options?: Omit<ExtractOptions, "url" | "schema" | "prompt">): Promise<ExtractJobResponse>;
84
- /**
85
- * Extract article/blog post information
86
- * Pre-built schema for content extraction
87
- *
88
- * @example
89
- * ```ts
90
- * const job = await client.extract.article("https://blog.example.com/post");
91
- * ```
92
- */
93
- article(url: string, options?: Omit<ExtractOptions, "url" | "schema" | "prompt">): Promise<ExtractJobResponse>;
94
- /**
95
- * Extract contact information from a page
96
- * Pre-built schema for contact page scraping
97
- *
98
- * @example
99
- * ```ts
100
- * const job = await client.extract.contact("https://example.com/contact");
101
- * ```
102
- */
103
- contact(url: string, options?: Omit<ExtractOptions, "url" | "schema" | "prompt">): Promise<ExtractJobResponse>;
104
- }
105
- //# sourceMappingURL=extract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/resources/extract.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D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4
- */
5
- import { post } from "../utils/request";
6
- /**
7
- * Extract resource class
8
- * Provides methods for structured data extraction using LLMs
9
- */
10
- export class ExtractResource {
11
- ctx;
12
- constructor(ctx) {
13
- this.ctx = ctx;
14
- }
15
- /**
16
- * Create a new extraction job
17
- * Either schema or prompt must be provided
18
- *
19
- * @example
20
- * ```ts
21
- * // Schema-based extraction
22
- * const job = await client.extract.create({
23
- * url: "https://example.com/product",
24
- * schema: {
25
- * type: "object",
26
- * properties: {
27
- * name: { type: "string" },
28
- * price: { type: "number" },
29
- * features: { type: "array", items: { type: "string" } }
30
- * }
31
- * }
32
- * });
33
- *
34
- * // Prompt-based extraction
35
- * const job = await client.extract.create({
36
- * url: "https://example.com/article",
37
- * prompt: "Extract the main points and author name"
38
- * });
39
- * ```
40
- */
41
- async create(options) {
42
- if (!options.schema && !options.prompt) {
43
- throw new Error("Either 'schema' or 'prompt' must be provided");
44
- }
45
- const body = {
46
- url: options.url,
47
- schema: options.schema,
48
- prompt: options.prompt,
49
- onlyMainContent: options.onlyMainContent,
50
- excludeTags: options.excludeTags,
51
- excludeSelectors: options.excludeSelectors,
52
- model: options.model,
53
- temperature: options.temperature,
54
- webhook: options.webhook,
55
- headers: options.headers,
56
- timeout: options.timeout,
57
- };
58
- const result = await post(this.ctx, "/v1/extract", body);
59
- return result.data;
60
- }
61
- /**
62
- * Extract data using a JSON Schema
63
- * Convenience method for schema-based extraction
64
- *
65
- * @example
66
- * ```ts
67
- * const job = await client.extract.withSchema(
68
- * "https://example.com/product",
69
- * {
70
- * type: "object",
71
- * properties: {
72
- * name: { type: "string" },
73
- * price: { type: "number" }
74
- * }
75
- * }
76
- * );
77
- * ```
78
- */
79
- async withSchema(url, schema, options) {
80
- return this.create({
81
- url,
82
- schema,
83
- ...options,
84
- });
85
- }
86
- /**
87
- * Extract data using a natural language prompt
88
- * Convenience method for prompt-based extraction
89
- *
90
- * @example
91
- * ```ts
92
- * const job = await client.extract.withPrompt(
93
- * "https://example.com/article",
94
- * "Extract the article title, author, publication date, and a brief summary"
95
- * );
96
- * ```
97
- */
98
- async withPrompt(url, prompt, options) {
99
- return this.create({
100
- url,
101
- prompt,
102
- ...options,
103
- });
104
- }
105
- /**
106
- * Extract product information from a page
107
- * Pre-built schema for common e-commerce use case
108
- *
109
- * @example
110
- * ```ts
111
- * const job = await client.extract.product("https://shop.example.com/item");
112
- * ```
113
- */
114
- async product(url, options) {
115
- const productSchema = {
116
- type: "object",
117
- properties: {
118
- name: { type: "string", description: "Product name" },
119
- brand: { type: "string", description: "Brand name" },
120
- price: { type: "number", description: "Current price" },
121
- originalPrice: {
122
- type: "number",
123
- description: "Original price before discount",
124
- },
125
- currency: {
126
- type: "string",
127
- description: "Currency code (USD, EUR, etc.)",
128
- },
129
- description: { type: "string", description: "Product description" },
130
- features: {
131
- type: "array",
132
- items: { type: "string" },
133
- description: "List of product features",
134
- },
135
- images: {
136
- type: "array",
137
- items: { type: "string" },
138
- description: "Product image URLs",
139
- },
140
- availability: {
141
- type: "string",
142
- description: "In stock, out of stock, etc.",
143
- },
144
- rating: { type: "number", description: "Average rating" },
145
- reviewCount: { type: "number", description: "Number of reviews" },
146
- },
147
- required: ["name", "price"],
148
- };
149
- return this.create({
150
- url,
151
- schema: productSchema,
152
- model: "gpt-4o-mini",
153
- ...options,
154
- });
155
- }
156
- /**
157
- * Extract article/blog post information
158
- * Pre-built schema for content extraction
159
- *
160
- * @example
161
- * ```ts
162
- * const job = await client.extract.article("https://blog.example.com/post");
163
- * ```
164
- */
165
- async article(url, options) {
166
- const articleSchema = {
167
- type: "object",
168
- properties: {
169
- title: { type: "string", description: "Article title" },
170
- author: { type: "string", description: "Author name" },
171
- publishedAt: { type: "string", description: "Publication date" },
172
- summary: {
173
- type: "string",
174
- description: "Brief summary of the article",
175
- },
176
- content: { type: "string", description: "Main article content" },
177
- tags: {
178
- type: "array",
179
- items: { type: "string" },
180
- description: "Article tags or categories",
181
- },
182
- readingTime: {
183
- type: "number",
184
- description: "Estimated reading time in minutes",
185
- },
186
- },
187
- required: ["title", "content"],
188
- };
189
- return this.create({
190
- url,
191
- schema: articleSchema,
192
- onlyMainContent: true,
193
- ...options,
194
- });
195
- }
196
- /**
197
- * Extract contact information from a page
198
- * Pre-built schema for contact page scraping
199
- *
200
- * @example
201
- * ```ts
202
- * const job = await client.extract.contact("https://example.com/contact");
203
- * ```
204
- */
205
- async contact(url, options) {
206
- const contactSchema = {
207
- type: "object",
208
- properties: {
209
- companyName: {
210
- type: "string",
211
- description: "Company or organization name",
212
- },
213
- email: { type: "string", description: "Contact email address" },
214
- phone: { type: "string", description: "Phone number" },
215
- address: {
216
- type: "object",
217
- properties: {
218
- street: { type: "string" },
219
- city: { type: "string" },
220
- state: { type: "string" },
221
- postalCode: { type: "string" },
222
- country: { type: "string" },
223
- },
224
- description: "Physical address",
225
- },
226
- socialMedia: {
227
- type: "object",
228
- properties: {
229
- twitter: { type: "string" },
230
- linkedin: { type: "string" },
231
- facebook: { type: "string" },
232
- instagram: { type: "string" },
233
- },
234
- description: "Social media links",
235
- },
236
- },
237
- };
238
- return this.create({
239
- url,
240
- schema: contactSchema,
241
- onlyMainContent: false, // Contact info might be in footer
242
- ...options,
243
- });
244
- }
245
- }
246
- //# sourceMappingURL=extract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/resources/extract.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;GAGG;AACH,MAAM,OAAO,eAAe;IACN;IAApB,YAAoB,GAAmB;QAAnB,QAAG,GAAH,GAAG,CAAgB;IAAG,CAAC;IAE3C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,KAAK,CAAC,MAAM,CAAC,OAAuB;QAClC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CA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EAAE,QAAQ,EAAE;wBACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACzB,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBAC9B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;qBAC5B;oBACD,WAAW,EAAE,kBAAkB;iBAChC;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBAC5B,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBAC5B,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;qBAC9B;oBACD,WAAW,EAAE,oBAAoB;iBAClC;aACF;SACF,CAAC;QAEF,OAAO,IAAI,CAAC,MAAM,CAAC;YACjB,GAAG;YACH,MAAM,EAAE,aAAa;YACrB,eAAe,EAAE,KAAK,EAAE,kCAAkC;YAC1D,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Resources barrel export
3
- * Re-exports all resource classes
4
- */
5
- export { ScrapeResource } from "./scrape";
6
- export { CrawlResource } from "./crawl";
7
- export { ExtractResource } from "./extract";
8
- export { DorkResource } from "./dork";
9
- export { StatusResource } from "./status";
10
- export { DataResource } from "./data";
11
- export { WebhooksResource } from "./webhooks";
12
- export { KeysResource } from "./keys";
13
- export { AccountResource } from "./account";
14
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Resources barrel export
3
- * Re-exports all resource classes
4
- */
5
- export { ScrapeResource } from "./scrape";
6
- export { CrawlResource } from "./crawl";
7
- export { ExtractResource } from "./extract";
8
- export { DorkResource } from "./dork";
9
- export { StatusResource } from "./status";
10
- export { DataResource } from "./data";
11
- export { WebhooksResource } from "./webhooks";
12
- export { KeysResource } from "./keys";
13
- export { AccountResource } from "./account";
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}