@decodo/sdk-ts 2.7.0 → 3.1.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/README.md CHANGED
@@ -469,8 +469,14 @@ const { status, pages } = await client.webScrapingApi.crawl(
469
469
  { url: 'https://example.com', limit: 50, output: 'markdown' },
470
470
  { pollInterval: 5_000, timeout: 600_000 },
471
471
  );
472
+
473
+ if (status.status !== 'done') {
474
+ console.warn(`Crawl ended ${status.status}; ${pages.length} pages collected`);
475
+ }
472
476
  ```
473
477
 
478
+ `crawl` doesn't throw when a crawl ends `faulted`, `cancelled` or `truncated`. It returns the pages collected so far, and `status` is the full crawl status object, so check `status.status` before relying on `pages`. If the crawl hasn't settled before `timeout`, `crawl` throws a `TimeoutError` and the crawl keeps running on the server; call `cancelCrawl` to stop it.
479
+
474
480
  To drive a crawl step by step, start it and poll separately for status and pages:
475
481
 
476
482
  ```typescript
@@ -496,35 +502,31 @@ Each target accepts one primary input parameter (`url`, `query`, `product_id`, o
496
502
 
497
503
  ### Search engines
498
504
 
499
- | Target | Description | Example |
500
- | ----------------------------- | --------------------------------- | --------------------------------------------------------------------- |
501
- | `Target.GoogleSearch` | Google Search results for a query | `{ target: Target.GoogleSearch, query: "coffee shops" }` |
502
- | `Target.GoogleMaps` | Google Maps search results | `{ target: Target.GoogleMaps, query: "coffee shops brooklyn" }` |
503
- | `Target.GoogleShoppingSearch` | Google Shopping search results | `{ target: Target.GoogleShoppingSearch, query: "laptop" }` |
504
- | `Target.GoogleSuggest` | Google Autocomplete suggestions | `{ target: Target.GoogleSuggest, query: "coffee" }` |
505
- | `Target.GoogleLens` | Google Lens reverse image search | `{ target: Target.GoogleLens, query: "https://example.com/cat.jpg" }` |
506
- | `Target.BingSearch` | Bing Search results | `{ target: Target.BingSearch, query: "electric vehicles" }` |
505
+ | Target | Description | Example |
506
+ | --------------------- | --------------------------------- | --------------------------------------------------------------------- |
507
+ | `Target.GoogleSearch` | Google Search results for a query | `{ target: Target.GoogleSearch, query: "coffee shops" }` |
508
+ | `Target.GoogleLens` | Google Lens reverse image search | `{ target: Target.GoogleLens, query: "https://example.com/cat.jpg" }` |
509
+ | `Target.BingSearch` | Bing Search results | `{ target: Target.BingSearch, query: "electric vehicles" }` |
507
510
 
508
511
  ### eCommerce
509
512
 
510
- | Target | Description | Example |
511
- | ----------------------- | ------------------------------------- | ---------------------------------------------------------------------- |
512
- | `Target.AmazonProduct` | Amazon product detail page by ASIN | `{ target: Target.AmazonProduct, query: "B09H74FXNW" }` |
513
- | `Target.AmazonSearch` | Amazon search results | `{ target: Target.AmazonSearch, query: "laptop" }` |
514
- | `Target.AmazonPricing` | Amazon pricing and offers | `{ target: Target.AmazonPricing, query: "B09H74FXNW" }` |
515
- | `Target.WalmartProduct` | Walmart product page by product ID | `{ target: Target.WalmartProduct, product_id: "15296401808" }` |
516
- | `Target.TargetProduct` | Target.com product page by product ID | `{ target: Target.TargetProduct, product_id: "92186007" }` |
517
- | `Target.Ecommerce` | Generic eCommerce page with parser | `{ target: Target.Ecommerce, url: "https://example.com/product/123" }` |
513
+ | Target | Description | Example |
514
+ | ----------------------- | ------------------------------------- | -------------------------------------------------------------- |
515
+ | `Target.AmazonProduct` | Amazon product detail page by ASIN | `{ target: Target.AmazonProduct, query: "B09H74FXNW" }` |
516
+ | `Target.AmazonSearch` | Amazon search results | `{ target: Target.AmazonSearch, query: "laptop" }` |
517
+ | `Target.AmazonPricing` | Amazon pricing and offers | `{ target: Target.AmazonPricing, query: "B09H74FXNW" }` |
518
+ | `Target.WalmartProduct` | Walmart product page by product ID | `{ target: Target.WalmartProduct, product_id: "15296401808" }` |
519
+ | `Target.TargetProduct` | Target.com product page by product ID | `{ target: Target.TargetProduct, product_id: "92186007" }` |
518
520
 
519
521
  ### Social media
520
522
 
521
- | Target | Description | Example |
522
- | ------------------------ | ----------------------- | ----------------------------------------------------------------------------- |
523
- | `Target.RedditPost` | Reddit post by URL | `{ target: Target.RedditPost, url: "https://reddit.com/r/nba/..." }` |
524
- | `Target.RedditSubreddit` | Reddit subreddit by URL | `{ target: Target.RedditSubreddit, url: "https://reddit.com/r/nba/" }` |
525
- | `Target.YoutubeVideo` | YouTube video by ID | `{ target: Target.YoutubeVideo, query: "dFu9aKJoqGg" }` |
526
- | `Target.YoutubeSearch` | YouTube search results | `{ target: Target.YoutubeSearch, query: "ambient music" }` |
527
- | `Target.TiktokPost` | TikTok post by URL | `{ target: Target.TiktokPost, url: "https://www.tiktok.com/@nba/video/..." }` |
523
+ | Target | Description | Example |
524
+ | ------------------------ | ---------------------------- | ----------------------------------------------------------------------------- |
525
+ | `Target.RedditPost` | Reddit post by URL | `{ target: Target.RedditPost, url: "https://reddit.com/r/nba/..." }` |
526
+ | `Target.RedditSubreddit` | Reddit subreddit by URL | `{ target: Target.RedditSubreddit, url: "https://reddit.com/r/nba/" }` |
527
+ | `Target.YoutubeMetadata` | YouTube video metadata by ID | `{ target: Target.YoutubeMetadata, query: "dFu9aKJoqGg" }` |
528
+ | `Target.YoutubeSearch` | YouTube search results | `{ target: Target.YoutubeSearch, query: "ambient music" }` |
529
+ | `Target.TiktokPost` | TikTok post by URL | `{ target: Target.TiktokPost, url: "https://www.tiktok.com/@nba/video/..." }` |
528
530
 
529
531
  ### AI tools
530
532
 
@@ -543,8 +545,6 @@ Each target accepts one primary input parameter (`url`, `query`, `product_id`, o
543
545
  | `Target.Google` | Raw Google URL scraping | `{ target: Target.Google, url: "https://google.com/search?q=laptop" }` |
544
546
  | `Target.Amazon` | Raw Amazon URL scraping | `{ target: Target.Amazon, url: "https://amazon.com/dp/B09H74FXNW" }` |
545
547
 
546
- > `Target.UniversalEcommerce` isn't listed above because it doesn't accept a primary input parameter like `url`, `query`, `product_id`, or `prompt`. It only accepts optional configuration fields such as `callback_url`.
547
-
548
548
  For the full target list and parameter details, see the API documentation:
549
549
 
550
550
  - [Target list](https://help.decodo.com/docs/web-scraping-api-targets)