scrapebadger 0.64.0 → 0.65.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 CHANGED
@@ -9,7 +9,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
  var WebSocket__default = /*#__PURE__*/_interopDefault(WebSocket);
10
10
 
11
11
  // src/internal/version.ts
12
- var SDK_VERSION = "0.64.0";
12
+ var SDK_VERSION = "0.65.0";
13
13
 
14
14
  // src/internal/exceptions.ts
15
15
  var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
@@ -213,7 +213,7 @@ var BaseClient = class _BaseClient {
213
213
  };
214
214
  }
215
215
  /**
216
- * Make an HTTP request and return both data and rate limit headers.
216
+ * Make an HTTP request and return the data with its rate limit, status and headers.
217
217
  */
218
218
  async requestWithHeaders(path, options = {}) {
219
219
  return this.requestRaw(path, options);
@@ -276,7 +276,7 @@ var BaseClient = class _BaseClient {
276
276
  }
277
277
  const data = await this.handleResponse(httpResponse);
278
278
  const rateLimit = this.parseRateLimitHeaders(httpResponse.headers);
279
- return { data, rateLimit };
279
+ return { data, rateLimit, status: httpResponse.status, headers: httpResponse.headers };
280
280
  } catch (error) {
281
281
  lastError = error;
282
282
  if (!_BaseClient.isRetryable(error)) {
@@ -4591,17 +4591,11 @@ var UsersClient4 = class {
4591
4591
  async get(username) {
4592
4592
  return this.client.request(`/v1/instagram/users/${username}`);
4593
4593
  }
4594
- /**
4595
- * Get "About this account" metadata for a user.
4596
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4597
- */
4594
+ /** Get "About this account" metadata for a user. */
4598
4595
  async about(username) {
4599
4596
  return this.client.request(`/v1/instagram/users/${username}/about`);
4600
4597
  }
4601
- /**
4602
- * Get accounts related/suggested for a user.
4603
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4604
- */
4598
+ /** Get accounts related/suggested for a user. */
4605
4599
  async related(username) {
4606
4600
  return this.client.request(`/v1/instagram/users/${username}/related`);
4607
4601
  }
@@ -4610,36 +4604,25 @@ var UsersClient4 = class {
4610
4604
  return this.media(`/v1/instagram/users/${username}/posts`, options);
4611
4605
  }
4612
4606
  /**
4613
- * Get a user's video posts (IGTV/feed videos).
4614
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4607
+ * Get a user's video posts from their feed. A page may hold slightly more than
4608
+ * `amount` items; pass `next_cursor` back as `cursor` to continue the feed.
4615
4609
  */
4616
4610
  async videos(username, options = {}) {
4617
4611
  return this.media(`/v1/instagram/users/${username}/videos`, options);
4618
4612
  }
4619
- /**
4620
- * Get a user's reels.
4621
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4622
- */
4613
+ /** Get a user's reels. */
4623
4614
  async reels(username, options = {}) {
4624
4615
  return this.media(`/v1/instagram/users/${username}/reels`, options);
4625
4616
  }
4626
- /**
4627
- * Get media a user is tagged in.
4628
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4629
- */
4617
+ /** Get media a user is tagged in. */
4630
4618
  async tagged(username, options = {}) {
4631
4619
  return this.media(`/v1/instagram/users/${username}/tagged`, options);
4632
4620
  }
4633
- /**
4634
- * Get a user's pinned posts.
4635
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4636
- */
4621
+ /** Get a user's pinned posts. */
4637
4622
  async pinned(username) {
4638
4623
  return this.client.request(`/v1/instagram/users/${username}/pinned`);
4639
4624
  }
4640
4625
  /**
4641
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4642
- *
4643
4626
  * Get a user's followers.
4644
4627
  *
4645
4628
  * @param username - Instagram username.
@@ -4656,19 +4639,13 @@ var UsersClient4 = class {
4656
4639
  }
4657
4640
  });
4658
4641
  }
4659
- /**
4660
- * Get the accounts a user follows.
4661
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4662
- */
4642
+ /** Get the accounts a user follows. */
4663
4643
  async following(username, options = {}) {
4664
4644
  return this.client.request(`/v1/instagram/users/${username}/following`, {
4665
4645
  params: { amount: options.amount, cursor: options.cursor }
4666
4646
  });
4667
4647
  }
4668
- /**
4669
- * Search within a user's followers by name/username.
4670
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4671
- */
4648
+ /** Search within a user's followers by name/username. */
4672
4649
  async searchFollowers(username, query, options = {}) {
4673
4650
  return this.client.request(
4674
4651
  `/v1/instagram/users/${username}/followers/search`,
@@ -4677,17 +4654,11 @@ var UsersClient4 = class {
4677
4654
  }
4678
4655
  );
4679
4656
  }
4680
- /**
4681
- * Get a user's currently-live stories.
4682
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4683
- */
4657
+ /** Get a user's currently-live stories. */
4684
4658
  async stories(username) {
4685
4659
  return this.client.request(`/v1/instagram/users/${username}/stories`);
4686
4660
  }
4687
- /**
4688
- * Get a user's story highlights.
4689
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4690
- */
4661
+ /** Get a user's story highlights. */
4691
4662
  async highlights(username) {
4692
4663
  return this.client.request(`/v1/instagram/users/${username}/highlights`);
4693
4664
  }
@@ -4712,10 +4683,7 @@ var MediaClient = class {
4712
4683
  async get(code) {
4713
4684
  return this.client.request(`/v1/instagram/media/${code}`);
4714
4685
  }
4715
- /**
4716
- * Get oEmbed metadata for a media permalink.
4717
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4718
- */
4686
+ /** Get oEmbed metadata for a media permalink. */
4719
4687
  async oembed(code) {
4720
4688
  return this.client.request(`/v1/instagram/media/${code}/oembed`);
4721
4689
  }
@@ -4725,27 +4693,18 @@ var MediaClient = class {
4725
4693
  params: { amount: options.amount, cursor: options.cursor }
4726
4694
  });
4727
4695
  }
4728
- /**
4729
- * Get the users who liked a media.
4730
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4731
- */
4696
+ /** Get the users who liked a media. */
4732
4697
  async likers(code) {
4733
4698
  return this.client.request(`/v1/instagram/media/${code}/likers`);
4734
4699
  }
4735
- /**
4736
- * Get replies to a comment.
4737
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4738
- */
4700
+ /** Get replies to a comment. */
4739
4701
  async replies(code, commentId, options = {}) {
4740
4702
  return this.client.request(
4741
4703
  `/v1/instagram/media/${code}/comments/${commentId}/replies`,
4742
4704
  { params: { amount: options.amount, cursor: options.cursor } }
4743
4705
  );
4744
4706
  }
4745
- /**
4746
- * Get the users who liked a comment.
4747
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4748
- */
4707
+ /** Get the users who liked a comment. */
4749
4708
  async commentLikers(code, commentId) {
4750
4709
  return this.client.request(
4751
4710
  `/v1/instagram/media/${code}/comments/${commentId}/likers`
@@ -4759,64 +4718,43 @@ var SearchClient4 = class {
4759
4718
  constructor(client) {
4760
4719
  this.client = client;
4761
4720
  }
4762
- /**
4763
- * Search accounts by name/username.
4764
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4765
- */
4721
+ /** Search accounts by name/username. */
4766
4722
  async users(query) {
4767
4723
  return this.client.request("/v1/instagram/search/users", {
4768
4724
  params: { query }
4769
4725
  });
4770
4726
  }
4771
- /**
4772
- * Search hashtags.
4773
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4774
- */
4727
+ /** Search hashtags. */
4775
4728
  async hashtags(query) {
4776
4729
  return this.client.request("/v1/instagram/search/hashtags", {
4777
4730
  params: { query }
4778
4731
  });
4779
4732
  }
4780
- /**
4781
- * Search places/locations.
4782
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4783
- */
4733
+ /** Search places/locations (global ranking). */
4784
4734
  async places(query) {
4785
4735
  return this.client.request("/v1/instagram/search/places", {
4786
4736
  params: { query }
4787
4737
  });
4788
4738
  }
4789
- /**
4790
- * Search reels.
4791
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4792
- */
4739
+ /** Search reels. */
4793
4740
  async reels(query) {
4794
4741
  return this.client.request("/v1/instagram/search/reels", {
4795
4742
  params: { query }
4796
4743
  });
4797
4744
  }
4798
- /**
4799
- * Search music/audio tracks.
4800
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4801
- */
4745
+ /** Search music/audio tracks. */
4802
4746
  async music(query) {
4803
4747
  return this.client.request("/v1/instagram/search/music", {
4804
4748
  params: { query }
4805
4749
  });
4806
4750
  }
4807
- /**
4808
- * Get blended "top" results (users, hashtags, and places).
4809
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4810
- */
4751
+ /** Get blended "top" results (users, hashtags, and places). */
4811
4752
  async top(query) {
4812
4753
  return this.client.request("/v1/instagram/search/top", {
4813
4754
  params: { query }
4814
4755
  });
4815
4756
  }
4816
- /**
4817
- * Get typeahead/autocomplete suggestions (mixed entity types).
4818
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4819
- */
4757
+ /** Get typeahead/autocomplete suggestions (mixed entity types). */
4820
4758
  async autocomplete(query) {
4821
4759
  return this.client.request("/v1/instagram/search/autocomplete", {
4822
4760
  params: { query }
@@ -4835,31 +4773,19 @@ var HashtagsClient = class {
4835
4773
  constructor(client) {
4836
4774
  this.client = client;
4837
4775
  }
4838
- /**
4839
- * Get a hashtag's info (media count, cover).
4840
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4841
- */
4776
+ /** Get a hashtag's info (media count, cover). */
4842
4777
  async get(tag) {
4843
4778
  return this.client.request(`/v1/instagram/hashtags/${tag}`);
4844
4779
  }
4845
- /**
4846
- * Get the top/popular media for a hashtag.
4847
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4848
- */
4780
+ /** Get the top/popular media for a hashtag. */
4849
4781
  async top(tag, options = {}) {
4850
4782
  return mediaFeed(this.client, `/v1/instagram/hashtags/${tag}/top`, options);
4851
4783
  }
4852
- /**
4853
- * Get the most recent media for a hashtag.
4854
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4855
- */
4784
+ /** Get the most recent media for a hashtag. */
4856
4785
  async recent(tag, options = {}) {
4857
4786
  return mediaFeed(this.client, `/v1/instagram/hashtags/${tag}/recent`, options);
4858
4787
  }
4859
- /**
4860
- * Get reels for a hashtag.
4861
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4862
- */
4788
+ /** Get reels for a hashtag. */
4863
4789
  async reels(tag, options = {}) {
4864
4790
  return mediaFeed(this.client, `/v1/instagram/hashtags/${tag}/reels`, options);
4865
4791
  }
@@ -4869,31 +4795,19 @@ var LocationsClient = class {
4869
4795
  constructor(client) {
4870
4796
  this.client = client;
4871
4797
  }
4872
- /**
4873
- * Get a location's info.
4874
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4875
- */
4798
+ /** Get a location's info. */
4876
4799
  async get(pk) {
4877
4800
  return this.client.request(`/v1/instagram/locations/${pk}`);
4878
4801
  }
4879
- /**
4880
- * Get the top/popular media for a location.
4881
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4882
- */
4802
+ /** Get the top/popular media for a location. */
4883
4803
  async top(pk, options = {}) {
4884
4804
  return mediaFeed(this.client, `/v1/instagram/locations/${pk}/top`, options);
4885
4805
  }
4886
- /**
4887
- * Get the most recent media for a location.
4888
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4889
- */
4806
+ /** Get the most recent media for a location. */
4890
4807
  async recent(pk, options = {}) {
4891
4808
  return mediaFeed(this.client, `/v1/instagram/locations/${pk}/recent`, options);
4892
4809
  }
4893
- /**
4894
- * Search locations by name.
4895
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4896
- */
4810
+ /** Search locations by name. */
4897
4811
  async search(query) {
4898
4812
  return this.client.request("/v1/instagram/locations/search", {
4899
4813
  params: { query }
@@ -4905,24 +4819,15 @@ var AudioClient = class {
4905
4819
  constructor(client) {
4906
4820
  this.client = client;
4907
4821
  }
4908
- /**
4909
- * Get an audio track's info.
4910
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4911
- */
4822
+ /** Get an audio track's info. */
4912
4823
  async get(audioId) {
4913
4824
  return this.client.request(`/v1/instagram/audio/${audioId}`);
4914
4825
  }
4915
- /**
4916
- * Get media that use an audio track.
4917
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4918
- */
4826
+ /** Get media that use an audio track. */
4919
4827
  async media(audioId, options = {}) {
4920
4828
  return mediaFeed(this.client, `/v1/instagram/audio/${audioId}/media`, options);
4921
4829
  }
4922
- /**
4923
- * Get currently-trending audio tracks.
4924
- * @deprecated Temporarily unavailable — authenticated data is temporarily offline.
4925
- */
4830
+ /** Get currently-trending audio tracks. */
4926
4831
  async trending() {
4927
4832
  return this.client.request("/v1/instagram/audio/trending");
4928
4833
  }
@@ -5080,6 +4985,112 @@ var AccountClient = class {
5080
4985
  }
5081
4986
  };
5082
4987
 
4988
+ // src/agent/client.ts
4989
+ var AgentClient = class {
4990
+ constructor(client) {
4991
+ this.client = client;
4992
+ }
4993
+ /**
4994
+ * Quote a call: its cost, whether its parameters are valid, and its latency.
4995
+ * Free: nothing runs and nothing is charged.
4996
+ *
4997
+ * @param method - HTTP method of the call to quote.
4998
+ * @param path - Path of the call, e.g. "/v1/google/search" (the "/v1" prefix is optional).
4999
+ * @param options - The call's query `params` and JSON `body`.
5000
+ * @throws NotFoundError - No such endpoint.
5001
+ */
5002
+ async quote(method, path, options = {}) {
5003
+ return this.client.request("/v1/quote", {
5004
+ method: "POST",
5005
+ body: { method, path, params: options.params, body: options.body }
5006
+ });
5007
+ }
5008
+ /**
5009
+ * Send feedback (an API or field you needed and couldn't find) or a bug
5010
+ * report. Free, never billed; rate limited per key (429 when over the limit).
5011
+ *
5012
+ * @param summary - One-line summary, 3-200 characters.
5013
+ * @param options - `type` ("feedback" default, or "bug"), `details`, `requestId`, `endpoint`, `contact`.
5014
+ */
5015
+ async feedback(summary, options = {}) {
5016
+ return this.client.request("/v1/feedback", {
5017
+ method: "POST",
5018
+ body: {
5019
+ type: options.type ?? "feedback",
5020
+ summary,
5021
+ details: options.details,
5022
+ request_id: options.requestId,
5023
+ endpoint: options.endpoint,
5024
+ contact: options.contact
5025
+ }
5026
+ });
5027
+ }
5028
+ /**
5029
+ * Report a bug: a wrong or empty result for valid input, a misleading error,
5030
+ * or a price mismatch. Same as `feedback(summary, { ...options, type: "bug" })`.
5031
+ *
5032
+ * @param summary - One-line summary, 3-200 characters.
5033
+ * @param options - `details`, `requestId` (the failing call's X-Request-ID), `endpoint`, `contact`.
5034
+ */
5035
+ async reportBug(summary, options = {}) {
5036
+ return this.feedback(summary, { ...options, type: "bug" });
5037
+ }
5038
+ };
5039
+ var ResultsClient = class {
5040
+ constructor(client) {
5041
+ this.client = client;
5042
+ }
5043
+ /**
5044
+ * Replay a recent result, optionally trimmed. Free.
5045
+ *
5046
+ * @param resultId - `X-Result-ID` of the original call.
5047
+ * @param options - `jq`, `fields`, `maxItems`, `summary` view params.
5048
+ * @returns The original response body, reshaped — any JSON value.
5049
+ * @throws NotFoundError - Unknown result, or it expired (~15 minutes).
5050
+ */
5051
+ async get(resultId, options = {}) {
5052
+ const { jq, fields, maxItems, summary } = options;
5053
+ return this.client.request(`/v1/results/${encodeURIComponent(resultId)}`, {
5054
+ params: {
5055
+ jq,
5056
+ fields: Array.isArray(fields) ? fields.join(",") : fields,
5057
+ max_items: maxItems,
5058
+ summary: summary ? true : void 0
5059
+ }
5060
+ });
5061
+ }
5062
+ };
5063
+ var RequestsClient = class {
5064
+ constructor(client) {
5065
+ this.client = client;
5066
+ }
5067
+ /**
5068
+ * Poll an async request. Free.
5069
+ *
5070
+ * @param requestId - `request_id` from the 202 response.
5071
+ * @returns `running: true` while in progress; once done, `data` is the original body.
5072
+ * @throws NotFoundError - Unknown or expired request (one that never completed was not billed).
5073
+ * @throws ScrapeBadgerError - The original call finished with an error status (as the matching subclass).
5074
+ */
5075
+ async get(requestId) {
5076
+ const { data, status, headers } = await this.client.requestWithHeaders(
5077
+ `/v1/requests/${encodeURIComponent(requestId)}`
5078
+ );
5079
+ const running = status === 202;
5080
+ const retryAfter = running ? data?.retry_after_seconds : void 0;
5081
+ const credits = headers?.get("X-Credits-Used");
5082
+ return {
5083
+ requestId,
5084
+ running,
5085
+ status: status ?? 200,
5086
+ retryAfterSeconds: retryAfter ?? null,
5087
+ resultId: headers?.get("X-Result-ID") ?? null,
5088
+ creditsUsed: credits && /^\d+$/.test(credits) ? Number(credits) : null,
5089
+ data
5090
+ };
5091
+ }
5092
+ };
5093
+
5083
5094
  // src/airbnb/client.ts
5084
5095
  var AirbnbClient = class {
5085
5096
  client;
@@ -9400,7 +9411,7 @@ var PropertiesClient2 = class {
9400
9411
  };
9401
9412
 
9402
9413
  // src/zillow/agent.ts
9403
- var AgentClient = class {
9414
+ var AgentClient2 = class {
9404
9415
  client;
9405
9416
  constructor(client) {
9406
9417
  this.client = client;
@@ -9458,7 +9469,7 @@ var ZillowClient = class {
9458
9469
  this._gen = client;
9459
9470
  this.search = new SearchClient18(client);
9460
9471
  this.properties = new PropertiesClient2(client);
9461
- this.agent = new AgentClient(client);
9472
+ this.agent = new AgentClient2(client);
9462
9473
  this.reference = new ReferenceClient14(client);
9463
9474
  }
9464
9475
  // --- BEGIN generated by sdk/codegen/facade — do not edit ---
@@ -10507,6 +10518,12 @@ var ScrapeBadger = class {
10507
10518
  /** Amazon scraper API client — 14 endpoints */
10508
10519
  /** Account API client. (Generated from the OpenAPI spec.) */
10509
10520
  account;
10521
+ /** Quote a call before making it, and report bugs or send feedback. Free. */
10522
+ agent;
10523
+ /** Re-read a recent result (`X-Result-ID`) for free, optionally trimmed. */
10524
+ results;
10525
+ /** Poll a call made with `Prefer: respond-async`. Free. */
10526
+ requests;
10510
10527
  /** Airbnb API client. (Generated from the OpenAPI spec.) */
10511
10528
  airbnb;
10512
10529
  /** Aliexpress API client. (Generated from the OpenAPI spec.) */
@@ -10615,6 +10632,9 @@ var ScrapeBadger = class {
10615
10632
  this.instagram = new InstagramClient(this.baseClient);
10616
10633
  this.redfin = new RedfinClient(this.baseClient);
10617
10634
  this.account = new AccountClient(this.baseClient);
10635
+ this.agent = new AgentClient(this.baseClient);
10636
+ this.results = new ResultsClient(this.baseClient);
10637
+ this.requests = new RequestsClient(this.baseClient);
10618
10638
  this.airbnb = new AirbnbClient(this.baseClient);
10619
10639
  this.aliexpress = new AliexpressClient(this.baseClient);
10620
10640
  this.amazon = new AmazonClient(this.baseClient);
@@ -10650,6 +10670,7 @@ var ScrapeBadger = class {
10650
10670
  };
10651
10671
 
10652
10672
  exports.AccountRestrictedError = AccountRestrictedError;
10673
+ exports.AgentClient = AgentClient;
10653
10674
  exports.AmazonClient = AmazonClient;
10654
10675
  exports.AmazonListingsClient = ListingsClient;
10655
10676
  exports.AmazonProductsClient = ProductsClient2;
@@ -10751,6 +10772,8 @@ exports.RedditSearchClient = SearchClient3;
10751
10772
  exports.RedditSubredditsClient = SubredditsClient;
10752
10773
  exports.RedditUsersClient = UsersClient3;
10753
10774
  exports.RedfinClient = RedfinClient;
10775
+ exports.RequestsClient = RequestsClient;
10776
+ exports.ResultsClient = ResultsClient;
10754
10777
  exports.ScrapeBadger = ScrapeBadger;
10755
10778
  exports.ScrapeBadgerError = ScrapeBadgerError;
10756
10779
  exports.ServerError = ServerError;
@@ -10809,7 +10832,7 @@ exports.YoutubeSearchClient = SearchClient15;
10809
10832
  exports.YoutubeShortsClient = ShortsClient2;
10810
10833
  exports.YoutubeTrendingClient = TrendingClient2;
10811
10834
  exports.YoutubeVideosClient = VideosClient3;
10812
- exports.ZillowAgentClient = AgentClient;
10835
+ exports.ZillowAgentClient = AgentClient2;
10813
10836
  exports.ZillowClient = ZillowClient;
10814
10837
  exports.ZillowPropertiesClient = PropertiesClient2;
10815
10838
  exports.ZillowReferenceClient = ReferenceClient14;