scrapebadger 0.58.0 → 0.59.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.58.0";
12
+ var SDK_VERSION = "0.59.0";
13
13
 
14
14
  // src/internal/exceptions.ts
15
15
  var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
@@ -6529,6 +6529,127 @@ var WalmartClient = class {
6529
6529
  }
6530
6530
  };
6531
6531
 
6532
+ // src/gumtree/client.ts
6533
+ var GumtreeClient = class {
6534
+ constructor(client) {
6535
+ this.client = client;
6536
+ }
6537
+ /**
6538
+ * Search gumtree.com listings.
6539
+ *
6540
+ * @param params - Optional query, category, location (+ distance radius),
6541
+ * price, sort, seller type, urgent/photo flags, category-specific filters
6542
+ * and page (1-50).
6543
+ * @returns ~25-30 listings per page. Gumtree pins up to 5 paid featured ads
6544
+ * (`is_featured`) above the chosen sort order.
6545
+ * @throws AuthenticationError - If the API key is invalid.
6546
+ * @throws ValidationError - If the parameters are invalid.
6547
+ */
6548
+ async search(params = {}) {
6549
+ return this.client.request("/v1/gumtree/search", {
6550
+ params: {
6551
+ query: params.query,
6552
+ category: params.category,
6553
+ location: params.location,
6554
+ distance: params.distance,
6555
+ min_price: params.min_price,
6556
+ max_price: params.max_price,
6557
+ sort: params.sort,
6558
+ seller_type: params.seller_type,
6559
+ urgent_only: params.urgent_only,
6560
+ with_photos: params.with_photos,
6561
+ filters: params.filters,
6562
+ page: params.page
6563
+ }
6564
+ });
6565
+ }
6566
+ /**
6567
+ * The filters, sort orders and radius options Gumtree offers for a category.
6568
+ *
6569
+ * Each filter lists its values with live result counts. Feed a `key` and a
6570
+ * `value` back into {@link search} as `filters: "key:value"`.
6571
+ *
6572
+ * @param params - Optional category (default `"all"`), location (default
6573
+ * `"uk"`) and query to scope the counts.
6574
+ */
6575
+ async searchFilters(params = {}) {
6576
+ return this.client.request("/v1/gumtree/search/filters", {
6577
+ params: {
6578
+ category: params.category,
6579
+ location: params.location,
6580
+ query: params.query
6581
+ }
6582
+ });
6583
+ }
6584
+ /**
6585
+ * Full listing: description, every attribute, images, location, seller and
6586
+ * similar ads. Motors listings carry the full vehicle spec.
6587
+ *
6588
+ * @param listingId - Gumtree listing id — the number at the end of a
6589
+ * `gumtree.com/p/...` URL.
6590
+ * @throws NotFoundError - If the listing does not exist or has expired.
6591
+ */
6592
+ async getListing(listingId) {
6593
+ return this.client.request(`/v1/gumtree/listings/${listingId}`);
6594
+ }
6595
+ /**
6596
+ * Every live listing by the seller of `listingId`. Gumtree keys a seller's
6597
+ * ad list by one of their ads, so any listing id of theirs works.
6598
+ *
6599
+ * @param listingId - Any Gumtree listing id belonging to the seller.
6600
+ * @param page - Page number, 1-50.
6601
+ */
6602
+ async getSellerListings(listingId, page) {
6603
+ return this.client.request(
6604
+ `/v1/gumtree/listings/${listingId}/seller-listings`,
6605
+ { params: { page } }
6606
+ );
6607
+ }
6608
+ /**
6609
+ * Gumtree search-box keyword suggestions, each with the category it maps to.
6610
+ *
6611
+ * @param query - Partial search term, e.g. `"iph"`.
6612
+ */
6613
+ async autocomplete(query) {
6614
+ return this.client.request("/v1/gumtree/autocomplete", {
6615
+ params: { query }
6616
+ });
6617
+ }
6618
+ /**
6619
+ * Resolve a place name or postcode prefix to Gumtree locations with coordinates.
6620
+ *
6621
+ * @param query - Town, area or postcode prefix (min 2 chars), e.g. `"manch"` or `"SW1A"`.
6622
+ */
6623
+ async locationAutocomplete(query) {
6624
+ return this.client.request(
6625
+ "/v1/gumtree/locations/autocomplete",
6626
+ { params: { query } }
6627
+ );
6628
+ }
6629
+ /**
6630
+ * Browse Gumtree's location tree: UK -> nations -> counties -> towns.
6631
+ *
6632
+ * @param parentId - Location id to list the children of. Defaults to the
6633
+ * United Kingdom (`10000392`) server-side.
6634
+ */
6635
+ async listLocations(parentId) {
6636
+ return this.client.request("/v1/gumtree/locations", {
6637
+ params: { parent_id: parentId }
6638
+ });
6639
+ }
6640
+ /**
6641
+ * Browse Gumtree's category tree. A node's `slug` is the {@link search} category.
6642
+ *
6643
+ * @param parentId - Category id to list the children of. Defaults to all
6644
+ * categories (`1`) server-side.
6645
+ */
6646
+ async listCategories(parentId) {
6647
+ return this.client.request("/v1/gumtree/categories", {
6648
+ params: { parent_id: parentId }
6649
+ });
6650
+ }
6651
+ };
6652
+
6532
6653
  // src/duckduckgo/search.ts
6533
6654
  var SearchClient10 = class {
6534
6655
  constructor(client) {
@@ -10029,6 +10150,8 @@ var ScrapeBadger = class {
10029
10150
  facebook;
10030
10151
  /** Walmart scraper API client — 11 endpoints (walmart.com, US-only) */
10031
10152
  walmart;
10153
+ /** Gumtree scraper API client — 8 endpoints (gumtree.com, UK-only) */
10154
+ gumtree;
10032
10155
  /** DuckDuckGo scraper API client — search, images, news, videos, autocomplete, instant, regions */
10033
10156
  duckduckgo;
10034
10157
  /** Bing scraper API client — 6 endpoints (search, images, videos, news, autocomplete, markets) */
@@ -10120,6 +10243,7 @@ var ScrapeBadger = class {
10120
10243
  this.ebay = new EbayClient(this.baseClient);
10121
10244
  this.facebook = new FacebookClient(this.baseClient);
10122
10245
  this.walmart = new WalmartClient(this.baseClient);
10246
+ this.gumtree = new GumtreeClient(this.baseClient);
10123
10247
  this.duckduckgo = new DuckDuckGoClient(this.baseClient);
10124
10248
  this.bing = new BingClient(this.baseClient);
10125
10249
  this.booking = new BookingClient(this.baseClient);
@@ -10198,6 +10322,7 @@ exports.GoogleShoppingClient = ShoppingClient;
10198
10322
  exports.GoogleShortsClient = ShortsClient;
10199
10323
  exports.GoogleTrendsClient = TrendsClient2;
10200
10324
  exports.GoogleVideosClient = VideosClient;
10325
+ exports.GumtreeClient = GumtreeClient;
10201
10326
  exports.IPNotAllowedError = IPNotAllowedError;
10202
10327
  exports.ImmobiliareClient = ImmobiliareClient;
10203
10328
  exports.InstagramAudioClient = AudioClient;