scrapebadger 0.26.1 → 0.27.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
@@ -4045,6 +4045,55 @@ var RedditClient = class {
4045
4045
  }
4046
4046
  };
4047
4047
 
4048
+ // src/apartments/client.ts
4049
+ var ApartmentsClient = class {
4050
+ constructor(client) {
4051
+ this.client = client;
4052
+ }
4053
+ /**
4054
+ * Search rental listings in a location.
4055
+ *
4056
+ * @param location - apartments.com slug (`"kansas-city-mo"`) or a ZIP.
4057
+ * @param params - Optional page and bed/price filters.
4058
+ *
4059
+ * @remarks
4060
+ * Cards are summaries with a rent/bed rollup. For per-unit rent and
4061
+ * availability, pass a card's `url` to {@link getProperty}.
4062
+ */
4063
+ async search(location, params = {}) {
4064
+ const query = {
4065
+ location,
4066
+ page: params.page ?? 1
4067
+ };
4068
+ if (params.beds !== void 0) query.beds = params.beds;
4069
+ if (params.minPrice !== void 0) query.min_price = params.minPrice;
4070
+ if (params.maxPrice !== void 0) query.max_price = params.maxPrice;
4071
+ return this.client.request("/v1/apartments/search", { params: query });
4072
+ }
4073
+ /**
4074
+ * Get one property with floor plans and per-unit inventory.
4075
+ *
4076
+ * @param url - Full property URL. Omit to look up by `slug` + `propertyId`.
4077
+ * @param params - `slug` and `propertyId` alternative to a URL.
4078
+ *
4079
+ * @remarks
4080
+ * Use `unit.rent` (the advertised price), not `unit.max_term_rent` — the
4081
+ * latter is the site's raw `data-maxrent`, roughly double the advertised
4082
+ * rent.
4083
+ */
4084
+ async getProperty(url, params = {}) {
4085
+ if (url) {
4086
+ return this.client.request("/v1/apartments/property", { params: { url } });
4087
+ }
4088
+ if (params.slug && params.propertyId) {
4089
+ return this.client.request(
4090
+ `/v1/apartments/properties/${params.slug}/${params.propertyId}`
4091
+ );
4092
+ }
4093
+ throw new Error("Provide either url, or both slug and propertyId");
4094
+ }
4095
+ };
4096
+
4048
4097
  // src/redfin/client.ts
4049
4098
  var RedfinClient = class {
4050
4099
  client;
@@ -6983,6 +7032,8 @@ var ScrapeBadger = class {
6983
7032
  google;
6984
7033
  /** Reddit scraper API client */
6985
7034
  reddit;
7035
+ /** Apartments.com scraper API client — search + property with unit-level pricing (US) */
7036
+ apartments;
6986
7037
  /** Redfin scraper API client — search, property, agent, autocomplete, markets (redfin.com, US) */
6987
7038
  redfin;
6988
7039
  /** Amazon scraper API client — 14 endpoints */
@@ -7050,6 +7101,7 @@ var ScrapeBadger = class {
7050
7101
  this.vinted = new VintedClient(this.baseClient);
7051
7102
  this.google = new GoogleClient(this.baseClient);
7052
7103
  this.reddit = new RedditClient(this.baseClient);
7104
+ this.apartments = new ApartmentsClient(this.baseClient);
7053
7105
  this.redfin = new RedfinClient(this.baseClient);
7054
7106
  this.amazon = new AmazonClient(this.baseClient);
7055
7107
  this.shopee = new ShopeeClient(this.baseClient);
@@ -7074,6 +7126,7 @@ exports.AmazonProductsClient = ProductsClient2;
7074
7126
  exports.AmazonReferenceClient = ReferenceClient2;
7075
7127
  exports.AmazonSearchClient = SearchClient4;
7076
7128
  exports.AmazonSellersClient = SellersClient;
7129
+ exports.ApartmentsClient = ApartmentsClient;
7077
7130
  exports.AuthenticationError = AuthenticationError;
7078
7131
  exports.ChatGPTAskClient = AskClient;
7079
7132
  exports.ChatGPTBrandClient = BrandClient;