@crawlkit-sh/sdk 1.0.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.
package/dist/index.js ADDED
@@ -0,0 +1,734 @@
1
+ // src/errors/index.ts
2
+ var CrawlKitError = class extends Error {
3
+ constructor(code, message, statusCode, creditsRefunded, creditsRemaining) {
4
+ super(message);
5
+ this.name = "CrawlKitError";
6
+ this.code = code;
7
+ this.statusCode = statusCode;
8
+ this.creditsRefunded = creditsRefunded;
9
+ this.creditsRemaining = creditsRemaining;
10
+ if (Error.captureStackTrace) {
11
+ Error.captureStackTrace(this, this.constructor);
12
+ }
13
+ }
14
+ };
15
+ var AuthenticationError = class extends CrawlKitError {
16
+ constructor(message = "Invalid or missing API key") {
17
+ super("VALIDATION_ERROR", message, 401);
18
+ this.name = "AuthenticationError";
19
+ }
20
+ };
21
+ var InsufficientCreditsError = class extends CrawlKitError {
22
+ constructor(message, creditsRefunded, creditsRemaining) {
23
+ super("INSUFFICIENT_CREDITS", message, 402, creditsRefunded, creditsRemaining);
24
+ this.name = "InsufficientCreditsError";
25
+ this.available = creditsRemaining;
26
+ }
27
+ };
28
+ var ValidationError = class extends CrawlKitError {
29
+ constructor(message) {
30
+ super("VALIDATION_ERROR", message, 400);
31
+ this.name = "ValidationError";
32
+ }
33
+ };
34
+ var RateLimitError = class extends CrawlKitError {
35
+ constructor(message = "Rate limit exceeded") {
36
+ super("RATE_LIMITED", message, 429);
37
+ this.name = "RateLimitError";
38
+ }
39
+ };
40
+ var TimeoutError = class extends CrawlKitError {
41
+ constructor(message, creditsRefunded, creditsRemaining) {
42
+ super("TIMEOUT", message, 408, creditsRefunded, creditsRemaining);
43
+ this.name = "TimeoutError";
44
+ }
45
+ };
46
+ var NotFoundError = class extends CrawlKitError {
47
+ constructor(message = "Resource not found") {
48
+ super("NOT_FOUND", message, 404);
49
+ this.name = "NotFoundError";
50
+ }
51
+ };
52
+ var NetworkError = class extends CrawlKitError {
53
+ constructor(code, message, creditsRefunded, creditsRemaining) {
54
+ super(code, message, 502, creditsRefunded, creditsRemaining);
55
+ this.name = "NetworkError";
56
+ }
57
+ };
58
+ function createErrorFromResponse(code, message, statusCode, creditsRefunded, creditsRemaining) {
59
+ const errorCode = code;
60
+ switch (statusCode) {
61
+ case 401:
62
+ return new AuthenticationError(message);
63
+ case 402:
64
+ return new InsufficientCreditsError(message, creditsRefunded, creditsRemaining);
65
+ case 429:
66
+ return new RateLimitError(message);
67
+ case 404:
68
+ return new NotFoundError(message);
69
+ }
70
+ switch (errorCode) {
71
+ case "VALIDATION_ERROR":
72
+ return new ValidationError(message);
73
+ case "INSUFFICIENT_CREDITS":
74
+ return new InsufficientCreditsError(message, creditsRefunded, creditsRemaining);
75
+ case "TIMEOUT":
76
+ return new TimeoutError(message, creditsRefunded, creditsRemaining);
77
+ case "RATE_LIMITED":
78
+ return new RateLimitError(message);
79
+ case "NOT_FOUND":
80
+ return new NotFoundError(message);
81
+ case "DNS_FAILED":
82
+ case "CONNECTION_REFUSED":
83
+ case "SSL_ERROR":
84
+ case "TOO_MANY_REDIRECTS":
85
+ case "PROXY_ERROR":
86
+ return new NetworkError(errorCode, message, creditsRefunded, creditsRemaining);
87
+ default:
88
+ return new CrawlKitError(
89
+ errorCode,
90
+ message,
91
+ statusCode,
92
+ creditsRefunded,
93
+ creditsRemaining
94
+ );
95
+ }
96
+ }
97
+
98
+ // src/resources/base.ts
99
+ var BaseResource = class {
100
+ constructor(config) {
101
+ this.config = config;
102
+ }
103
+ /**
104
+ * Make a POST request to the API
105
+ * @param endpoint - API endpoint path (e.g., '/v1/crawl/scrape')
106
+ * @param body - Request body object
107
+ * @returns Parsed response data
108
+ * @throws {CrawlKitError} On API errors
109
+ */
110
+ async post(endpoint, body) {
111
+ const url = `${this.config.baseUrl}${endpoint}`;
112
+ const controller = new AbortController();
113
+ const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
114
+ try {
115
+ const response = await this.config.fetch(url, {
116
+ method: "POST",
117
+ headers: {
118
+ "Content-Type": "application/json",
119
+ "Authorization": `ApiKey ${this.config.apiKey}`,
120
+ "User-Agent": "@crawlkit/sdk"
121
+ },
122
+ body: JSON.stringify(body),
123
+ signal: controller.signal
124
+ });
125
+ clearTimeout(timeoutId);
126
+ let json;
127
+ try {
128
+ json = await response.json();
129
+ } catch {
130
+ throw new CrawlKitError(
131
+ "PARSE_ERROR",
132
+ "Failed to parse API response",
133
+ response.status
134
+ );
135
+ }
136
+ if (!json.success) {
137
+ const errorResponse = json;
138
+ throw createErrorFromResponse(
139
+ errorResponse.error.code,
140
+ errorResponse.error.message,
141
+ response.status,
142
+ errorResponse.creditsRefunded,
143
+ errorResponse.creditsRemaining
144
+ );
145
+ }
146
+ return json.data;
147
+ } catch (error) {
148
+ clearTimeout(timeoutId);
149
+ if (error instanceof CrawlKitError) {
150
+ throw error;
151
+ }
152
+ if (error instanceof Error) {
153
+ if (error.name === "AbortError") {
154
+ throw new CrawlKitError(
155
+ "TIMEOUT",
156
+ `Request timed out after ${this.config.timeout}ms`,
157
+ 408
158
+ );
159
+ }
160
+ throw new CrawlKitError(
161
+ "UNKNOWN",
162
+ error.message || "An unknown error occurred",
163
+ 500
164
+ );
165
+ }
166
+ throw new CrawlKitError("UNKNOWN", "An unknown error occurred", 500);
167
+ }
168
+ }
169
+ /**
170
+ * Make a GET request to the API
171
+ * @param endpoint - API endpoint path
172
+ * @param params - Query parameters
173
+ * @returns Parsed response data
174
+ * @throws {CrawlKitError} On API errors
175
+ */
176
+ async get(endpoint, params) {
177
+ let url = `${this.config.baseUrl}${endpoint}`;
178
+ if (params) {
179
+ const searchParams = new URLSearchParams();
180
+ for (const [key, value] of Object.entries(params)) {
181
+ if (value !== void 0) {
182
+ searchParams.append(key, String(value));
183
+ }
184
+ }
185
+ const queryString = searchParams.toString();
186
+ if (queryString) {
187
+ url += `?${queryString}`;
188
+ }
189
+ }
190
+ const controller = new AbortController();
191
+ const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
192
+ try {
193
+ const response = await this.config.fetch(url, {
194
+ method: "GET",
195
+ headers: {
196
+ "Authorization": `ApiKey ${this.config.apiKey}`,
197
+ "User-Agent": "@crawlkit/sdk"
198
+ },
199
+ signal: controller.signal
200
+ });
201
+ clearTimeout(timeoutId);
202
+ let json;
203
+ try {
204
+ json = await response.json();
205
+ } catch {
206
+ throw new CrawlKitError(
207
+ "PARSE_ERROR",
208
+ "Failed to parse API response",
209
+ response.status
210
+ );
211
+ }
212
+ if (!json.success) {
213
+ const errorResponse = json;
214
+ throw createErrorFromResponse(
215
+ errorResponse.error.code,
216
+ errorResponse.error.message,
217
+ response.status,
218
+ errorResponse.creditsRefunded,
219
+ errorResponse.creditsRemaining
220
+ );
221
+ }
222
+ return json.data;
223
+ } catch (error) {
224
+ clearTimeout(timeoutId);
225
+ if (error instanceof CrawlKitError) {
226
+ throw error;
227
+ }
228
+ if (error instanceof Error) {
229
+ if (error.name === "AbortError") {
230
+ throw new CrawlKitError(
231
+ "TIMEOUT",
232
+ `Request timed out after ${this.config.timeout}ms`,
233
+ 408
234
+ );
235
+ }
236
+ throw new CrawlKitError(
237
+ "UNKNOWN",
238
+ error.message || "An unknown error occurred",
239
+ 500
240
+ );
241
+ }
242
+ throw new CrawlKitError("UNKNOWN", "An unknown error occurred", 500);
243
+ }
244
+ }
245
+ };
246
+
247
+ // src/resources/crawl.ts
248
+ var CrawlResource = class extends BaseResource {
249
+ /**
250
+ * Scrape a URL and return markdown, HTML, metadata, and links
251
+ *
252
+ * @param params - Scrape parameters
253
+ * @returns Scraped page data including markdown, HTML, metadata, and links
254
+ * @throws {CrawlKitError} On API errors
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * const result = await crawlkit.scrape({
259
+ * url: 'https://example.com',
260
+ * options: {
261
+ * onlyMainContent: true,
262
+ * waitFor: '#content'
263
+ * }
264
+ * });
265
+ * console.log(result.markdown);
266
+ * ```
267
+ *
268
+ * @costs 1 credit
269
+ */
270
+ async scrape(params) {
271
+ return this.post("/v1/crawl/scrape", params);
272
+ }
273
+ /**
274
+ * Extract structured data from a URL using AI
275
+ *
276
+ * @param params - Extract parameters including JSON schema
277
+ * @returns Extracted structured data along with page content
278
+ * @throws {CrawlKitError} On API errors
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * interface Product {
283
+ * name: string;
284
+ * price: number;
285
+ * }
286
+ *
287
+ * const result = await crawlkit.extract<Product>({
288
+ * url: 'https://example.com/product',
289
+ * schema: {
290
+ * type: 'object',
291
+ * properties: {
292
+ * name: { type: 'string' },
293
+ * price: { type: 'number' }
294
+ * }
295
+ * }
296
+ * });
297
+ * console.log(result.json.name, result.json.price);
298
+ * ```
299
+ *
300
+ * @costs 5 credits
301
+ */
302
+ async extract(params) {
303
+ return this.post("/v1/crawl/extract", params);
304
+ }
305
+ /**
306
+ * Perform a web search using DuckDuckGo
307
+ *
308
+ * @param params - Search parameters
309
+ * @returns Search results with titles, URLs, and snippets
310
+ * @throws {CrawlKitError} On API errors
311
+ *
312
+ * @example
313
+ * ```typescript
314
+ * const result = await crawlkit.search({
315
+ * query: 'typescript best practices',
316
+ * options: {
317
+ * maxResults: 10,
318
+ * timeRange: 'w' // Past week
319
+ * }
320
+ * });
321
+ * result.results.forEach(r => console.log(r.title, r.url));
322
+ * ```
323
+ *
324
+ * @costs 1 credit per page (~10 results)
325
+ */
326
+ async search(params) {
327
+ return this.post("/v1/crawl/search", params);
328
+ }
329
+ /**
330
+ * Take a full-page screenshot of a URL
331
+ *
332
+ * @param params - Screenshot parameters
333
+ * @returns Public URL of the screenshot
334
+ * @throws {CrawlKitError} On API errors
335
+ *
336
+ * @example
337
+ * ```typescript
338
+ * const result = await crawlkit.screenshot({
339
+ * url: 'https://example.com',
340
+ * options: {
341
+ * width: 1920,
342
+ * height: 1080,
343
+ * waitForSelector: '#content'
344
+ * }
345
+ * });
346
+ * console.log('Screenshot URL:', result.url);
347
+ * ```
348
+ *
349
+ * @costs 1 credit
350
+ */
351
+ async screenshot(params) {
352
+ return this.post("/v1/crawl/screenshot", params);
353
+ }
354
+ };
355
+
356
+ // src/resources/linkedin.ts
357
+ var LinkedInResource = class extends BaseResource {
358
+ /**
359
+ * Scrape a LinkedIn company profile
360
+ *
361
+ * @param params - Company profile parameters
362
+ * @returns Company profile data including description, employees, jobs, posts
363
+ * @throws {CrawlKitError} On API errors
364
+ *
365
+ * @example
366
+ * ```typescript
367
+ * const result = await crawlkit.linkedin.company({
368
+ * url: 'https://www.linkedin.com/company/openai',
369
+ * options: { includeJobs: true }
370
+ * });
371
+ * console.log(result.company.name);
372
+ * console.log(result.company.followers);
373
+ * console.log(result.company.jobs);
374
+ * ```
375
+ *
376
+ * @costs 1 credit
377
+ */
378
+ async company(params) {
379
+ return this.post("/v1/crawl/linkedin/company", params);
380
+ }
381
+ /**
382
+ * Scrape LinkedIn person profile(s)
383
+ *
384
+ * @param params - Person profile parameters (single URL or array of URLs, max 10)
385
+ * @returns Person profile data for each URL
386
+ * @throws {CrawlKitError} On API errors
387
+ *
388
+ * @example
389
+ * ```typescript
390
+ * // Single profile
391
+ * const result = await crawlkit.linkedin.person({
392
+ * url: 'https://www.linkedin.com/in/username'
393
+ * });
394
+ *
395
+ * // Multiple profiles (batch)
396
+ * const batchResult = await crawlkit.linkedin.person({
397
+ * url: [
398
+ * 'https://www.linkedin.com/in/user1',
399
+ * 'https://www.linkedin.com/in/user2'
400
+ * ]
401
+ * });
402
+ * console.log(`Success: ${batchResult.successCount}, Failed: ${batchResult.failedCount}`);
403
+ * ```
404
+ *
405
+ * @costs 3 credits per URL
406
+ */
407
+ async person(params) {
408
+ return this.post("/v1/crawl/linkedin/person", params);
409
+ }
410
+ };
411
+
412
+ // src/resources/instagram.ts
413
+ var InstagramResource = class extends BaseResource {
414
+ /**
415
+ * Scrape an Instagram profile
416
+ *
417
+ * @param params - Profile parameters (username or URL)
418
+ * @returns Profile data including bio, follower count, and recent posts
419
+ * @throws {CrawlKitError} On API errors
420
+ *
421
+ * @example
422
+ * ```typescript
423
+ * const result = await crawlkit.instagram.profile({
424
+ * username: 'instagram'
425
+ * });
426
+ * console.log(result.profile.full_name);
427
+ * console.log(result.profile.follower_count);
428
+ * console.log(result.profile.posts.length);
429
+ * ```
430
+ *
431
+ * @costs 1 credit
432
+ */
433
+ async profile(params) {
434
+ return this.post("/v1/crawl/instagram/profile", params);
435
+ }
436
+ /**
437
+ * Scrape Instagram content (post, reel, or video)
438
+ *
439
+ * @param params - Content parameters (shortcode or full URL)
440
+ * @returns Content data including media URLs, likes, comments, and owner info
441
+ * @throws {CrawlKitError} On API errors
442
+ *
443
+ * @example
444
+ * ```typescript
445
+ * // Using shortcode
446
+ * const result = await crawlkit.instagram.content({
447
+ * shortcode: 'CxIIgCCq8mg'
448
+ * });
449
+ *
450
+ * // Using full URL
451
+ * const result = await crawlkit.instagram.content({
452
+ * shortcode: 'https://www.instagram.com/p/CxIIgCCq8mg/'
453
+ * });
454
+ *
455
+ * console.log(result.post.like_count);
456
+ * console.log(result.post.video_url);
457
+ * ```
458
+ *
459
+ * @costs 1 credit
460
+ */
461
+ async content(params) {
462
+ return this.post("/v1/crawl/instagram/content", params);
463
+ }
464
+ };
465
+
466
+ // src/resources/appstore.ts
467
+ var AppStoreResource = class extends BaseResource {
468
+ /**
469
+ * Fetch Google Play Store reviews for an app
470
+ *
471
+ * @param params - Reviews parameters including app ID and optional pagination cursor
472
+ * @returns Reviews with pagination information
473
+ * @throws {CrawlKitError} On API errors
474
+ *
475
+ * @example
476
+ * ```typescript
477
+ * // First page
478
+ * const result = await crawlkit.appstore.playstoreReviews({
479
+ * appId: 'com.example.app',
480
+ * options: { lang: 'en' }
481
+ * });
482
+ *
483
+ * // Next page
484
+ * if (result.pagination.hasMore) {
485
+ * const nextPage = await crawlkit.appstore.playstoreReviews({
486
+ * appId: 'com.example.app',
487
+ * cursor: result.pagination.nextCursor
488
+ * });
489
+ * }
490
+ * ```
491
+ *
492
+ * @costs 1 credit per page
493
+ */
494
+ async playstoreReviews(params) {
495
+ return this.post("/v1/crawl/playstore/reviews", params);
496
+ }
497
+ /**
498
+ * Fetch Google Play Store app details
499
+ *
500
+ * @param params - App detail parameters
501
+ * @returns Comprehensive app information including ratings, screenshots, permissions
502
+ * @throws {CrawlKitError} On API errors
503
+ *
504
+ * @example
505
+ * ```typescript
506
+ * const result = await crawlkit.appstore.playstoreDetail({
507
+ * appId: 'com.example.app',
508
+ * options: { lang: 'en' }
509
+ * });
510
+ * console.log(result.appName);
511
+ * console.log(result.rating);
512
+ * console.log(result.installs);
513
+ * ```
514
+ *
515
+ * @costs 1 credit
516
+ */
517
+ async playstoreDetail(params) {
518
+ return this.post("/v1/crawl/playstore/detail", params);
519
+ }
520
+ /**
521
+ * Fetch Apple App Store reviews for an app
522
+ *
523
+ * @param params - Reviews parameters including app ID and optional pagination cursor
524
+ * @returns Reviews with pagination information
525
+ * @throws {CrawlKitError} On API errors
526
+ *
527
+ * @example
528
+ * ```typescript
529
+ * // First page
530
+ * const result = await crawlkit.appstore.appstoreReviews({
531
+ * appId: '123456789',
532
+ * options: { lang: 'en' }
533
+ * });
534
+ *
535
+ * // Paginate through all reviews
536
+ * let cursor = result.pagination.nextCursor;
537
+ * while (cursor) {
538
+ * const nextPage = await crawlkit.appstore.appstoreReviews({
539
+ * appId: '123456789',
540
+ * cursor
541
+ * });
542
+ * cursor = nextPage.pagination.nextCursor;
543
+ * }
544
+ * ```
545
+ *
546
+ * @costs 1 credit per page
547
+ */
548
+ async appstoreReviews(params) {
549
+ return this.post("/v1/crawl/appstore/reviews", params);
550
+ }
551
+ };
552
+
553
+ // src/client.ts
554
+ var CrawlKit = class {
555
+ /**
556
+ * Create a new CrawlKit client
557
+ *
558
+ * @param config - Client configuration
559
+ * @throws {AuthenticationError} If API key is invalid or missing
560
+ *
561
+ * @example
562
+ * ```typescript
563
+ * const crawlkit = new CrawlKit({
564
+ * apiKey: 'ck_your_api_key',
565
+ * timeout: 60000 // 60 seconds
566
+ * });
567
+ * ```
568
+ */
569
+ constructor(config) {
570
+ if (!config.apiKey) {
571
+ throw new AuthenticationError("API key is required");
572
+ }
573
+ if (!config.apiKey.startsWith("ck_")) {
574
+ throw new AuthenticationError(
575
+ 'Invalid API key format. API keys must start with "ck_"'
576
+ );
577
+ }
578
+ this.config = {
579
+ apiKey: config.apiKey,
580
+ baseUrl: config.baseUrl ?? "https://api.crawlkit.sh",
581
+ timeout: config.timeout ?? 3e4,
582
+ fetch: config.fetch ?? globalThis.fetch.bind(globalThis)
583
+ };
584
+ const resourceConfig = {
585
+ apiKey: this.config.apiKey,
586
+ baseUrl: this.config.baseUrl,
587
+ timeout: this.config.timeout,
588
+ fetch: this.config.fetch
589
+ };
590
+ this.crawl = new CrawlResource(resourceConfig);
591
+ this.linkedin = new LinkedInResource(resourceConfig);
592
+ this.instagram = new InstagramResource(resourceConfig);
593
+ this.appstore = new AppStoreResource(resourceConfig);
594
+ }
595
+ /**
596
+ * Scrape a URL and return markdown, HTML, metadata, and links
597
+ *
598
+ * @param params - Scrape parameters
599
+ * @returns Scraped page data including markdown, HTML, metadata, and links
600
+ * @throws {CrawlKitError} On API errors
601
+ *
602
+ * @example
603
+ * ```typescript
604
+ * // Basic scraping
605
+ * const result = await crawlkit.scrape({
606
+ * url: 'https://example.com'
607
+ * });
608
+ * console.log(result.markdown);
609
+ * console.log(result.metadata.title);
610
+ *
611
+ * // With browser automation
612
+ * const spaResult = await crawlkit.scrape({
613
+ * url: 'https://example.com/spa',
614
+ * options: {
615
+ * waitFor: '#content-loaded',
616
+ * actions: [
617
+ * { type: 'click', selector: '#load-more' },
618
+ * { type: 'wait', milliseconds: 2000 }
619
+ * ]
620
+ * }
621
+ * });
622
+ * ```
623
+ *
624
+ * @costs 1 credit
625
+ */
626
+ async scrape(params) {
627
+ return this.crawl.scrape(params);
628
+ }
629
+ /**
630
+ * Extract structured data from a URL using AI
631
+ *
632
+ * Uses LLM to extract data according to the provided JSON schema.
633
+ *
634
+ * @param params - Extract parameters including JSON schema
635
+ * @returns Extracted structured data along with page content
636
+ * @throws {CrawlKitError} On API errors
637
+ *
638
+ * @example
639
+ * ```typescript
640
+ * interface Product {
641
+ * name: string;
642
+ * price: number;
643
+ * description: string;
644
+ * inStock: boolean;
645
+ * }
646
+ *
647
+ * const result = await crawlkit.extract<Product>({
648
+ * url: 'https://example.com/product/123',
649
+ * schema: {
650
+ * type: 'object',
651
+ * properties: {
652
+ * name: { type: 'string' },
653
+ * price: { type: 'number' },
654
+ * description: { type: 'string' },
655
+ * inStock: { type: 'boolean' }
656
+ * }
657
+ * },
658
+ * options: {
659
+ * prompt: 'Extract product information from this page'
660
+ * }
661
+ * });
662
+ *
663
+ * // TypeScript knows result.json is Product
664
+ * console.log(result.json.name);
665
+ * console.log(result.json.price);
666
+ * ```
667
+ *
668
+ * @costs 5 credits
669
+ */
670
+ async extract(params) {
671
+ return this.crawl.extract(params);
672
+ }
673
+ /**
674
+ * Perform a web search using DuckDuckGo
675
+ *
676
+ * @param params - Search parameters
677
+ * @returns Search results with titles, URLs, and snippets
678
+ * @throws {CrawlKitError} On API errors
679
+ *
680
+ * @example
681
+ * ```typescript
682
+ * const result = await crawlkit.search({
683
+ * query: 'typescript best practices 2024',
684
+ * options: {
685
+ * maxResults: 20,
686
+ * timeRange: 'm', // Past month
687
+ * region: 'us-en'
688
+ * }
689
+ * });
690
+ *
691
+ * for (const item of result.results) {
692
+ * console.log(`${item.position}. ${item.title}`);
693
+ * console.log(` ${item.url}`);
694
+ * console.log(` ${item.snippet}\n`);
695
+ * }
696
+ * ```
697
+ *
698
+ * @costs 1 credit per page (~10 results)
699
+ */
700
+ async search(params) {
701
+ return this.crawl.search(params);
702
+ }
703
+ /**
704
+ * Take a full-page screenshot of a URL
705
+ *
706
+ * @param params - Screenshot parameters
707
+ * @returns Public URL of the screenshot
708
+ * @throws {CrawlKitError} On API errors
709
+ *
710
+ * @example
711
+ * ```typescript
712
+ * const result = await crawlkit.screenshot({
713
+ * url: 'https://example.com',
714
+ * options: {
715
+ * width: 1920,
716
+ * height: 1080,
717
+ * waitForSelector: '#main-content'
718
+ * }
719
+ * });
720
+ *
721
+ * console.log('Screenshot URL:', result.url);
722
+ * console.log(`Dimensions: ${result.width}x${result.height}`);
723
+ * ```
724
+ *
725
+ * @costs 1 credit
726
+ */
727
+ async screenshot(params) {
728
+ return this.crawl.screenshot(params);
729
+ }
730
+ };
731
+
732
+ export { AuthenticationError, CrawlKit, CrawlKitError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, TimeoutError, ValidationError, createErrorFromResponse };
733
+ //# sourceMappingURL=index.js.map
734
+ //# sourceMappingURL=index.js.map