scrapebadger 0.57.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.57.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) {
@@ -9339,6 +9460,204 @@ var DepopClient = class {
9339
9460
  // --- END generated by sdk/codegen/facade ---
9340
9461
  };
9341
9462
 
9463
+ // src/wallapop/client.ts
9464
+ var onlyTrue = (value) => value ? true : void 0;
9465
+ var WallapopClient = class {
9466
+ client;
9467
+ constructor(client) {
9468
+ this.client = client;
9469
+ }
9470
+ /**
9471
+ * Search Wallapop listings (40 per page).
9472
+ *
9473
+ * Needs a query, a `categoryId`, or both — unless `nextPage` is given, in
9474
+ * which case every other parameter is ignored.
9475
+ *
9476
+ * Costs 5 credits.
9477
+ *
9478
+ * @param query - Search text, e.g. "iphone 14" (optional with `categoryId` or `nextPage`).
9479
+ * @param options - Optional parameters (market, location/radius, category,
9480
+ * price, condition, brand/model/colour, cars filters, sort, cursor).
9481
+ * @returns Search response with matching listings and the next-page cursor.
9482
+ * @throws AuthenticationError - If the API key is invalid.
9483
+ * @throws ValidationError - If neither a query nor a category is given.
9484
+ */
9485
+ async search(query, options = {}) {
9486
+ return this.client.request("/v1/wallapop/search", {
9487
+ params: {
9488
+ query,
9489
+ market: options.market,
9490
+ latitude: options.latitude,
9491
+ longitude: options.longitude,
9492
+ distance_km: options.distanceKm,
9493
+ category_id: options.categoryId,
9494
+ min_price: options.minPrice,
9495
+ max_price: options.maxPrice,
9496
+ condition: options.condition,
9497
+ brand: options.brand,
9498
+ model: options.model,
9499
+ color: options.color,
9500
+ time_filter: options.timeFilter,
9501
+ shippable: onlyTrue(options.shippable),
9502
+ has_warranty: onlyTrue(options.hasWarranty),
9503
+ refurbished: onlyTrue(options.refurbished),
9504
+ min_year: options.minYear,
9505
+ max_year: options.maxYear,
9506
+ min_km: options.minKm,
9507
+ max_km: options.maxKm,
9508
+ gearbox: options.gearbox,
9509
+ min_horsepower: options.minHorsepower,
9510
+ max_horsepower: options.maxHorsepower,
9511
+ order_by: options.orderBy,
9512
+ next_page: options.nextPage
9513
+ }
9514
+ });
9515
+ }
9516
+ /**
9517
+ * Get a single listing's full detail.
9518
+ *
9519
+ * Costs 5 credits.
9520
+ *
9521
+ * @param itemId - Listing id (e.g. "nzxeknm5x562") or listing slug.
9522
+ * @param options - Optional parameters (market).
9523
+ * @returns Full listing detail with attributes, counters and location.
9524
+ * @throws NotFoundError - If the listing doesn't exist.
9525
+ */
9526
+ async getItem(itemId, options = {}) {
9527
+ return this.client.request(
9528
+ `/v1/wallapop/items/${encodeURIComponent(itemId)}`,
9529
+ { params: { market: options.market } }
9530
+ );
9531
+ }
9532
+ /**
9533
+ * Get a seller's profile with ratings, sales counters, response rate and
9534
+ * verifications.
9535
+ *
9536
+ * Costs 5 credits.
9537
+ *
9538
+ * @param userId - User id (e.g. "dqjwdd53wwzo") or profile slug (e.g. "alexc-25115753").
9539
+ * @param options - Optional parameters (market).
9540
+ * @returns User profile.
9541
+ * @throws NotFoundError - If the user doesn't exist.
9542
+ */
9543
+ async getUser(userId, options = {}) {
9544
+ return this.client.request(
9545
+ `/v1/wallapop/users/${encodeURIComponent(userId)}`,
9546
+ { params: { market: options.market } }
9547
+ );
9548
+ }
9549
+ /**
9550
+ * Get a seller's live listings (40 per page).
9551
+ *
9552
+ * Costs 5 credits.
9553
+ *
9554
+ * @param userId - User id or profile slug.
9555
+ * @param options - Optional parameters (market, nextPage).
9556
+ * @returns The seller's listings and the next-page cursor.
9557
+ * @throws NotFoundError - If the user doesn't exist.
9558
+ */
9559
+ async getUserItems(userId, options = {}) {
9560
+ return this.client.request(
9561
+ `/v1/wallapop/users/${encodeURIComponent(userId)}/items`,
9562
+ { params: { market: options.market, next_page: options.nextPage } }
9563
+ );
9564
+ }
9565
+ /**
9566
+ * Get the reviews a seller received, newest first (40 per page).
9567
+ *
9568
+ * Costs 5 credits.
9569
+ *
9570
+ * @param userId - User id or profile slug.
9571
+ * @param options - Optional parameters (market, nextPage).
9572
+ * @returns Reviews and the next-page cursor.
9573
+ * @throws NotFoundError - If the user doesn't exist.
9574
+ */
9575
+ async getUserReviews(userId, options = {}) {
9576
+ return this.client.request(
9577
+ `/v1/wallapop/users/${encodeURIComponent(userId)}/reviews`,
9578
+ { params: { market: options.market, next_page: options.nextPage } }
9579
+ );
9580
+ }
9581
+ /**
9582
+ * Get Wallapop's search-box suggestions for a partial query.
9583
+ *
9584
+ * Costs 1 credit.
9585
+ *
9586
+ * @param query - Partial search text, e.g. "bici".
9587
+ * @param options - Optional parameters (market).
9588
+ * @returns Autocomplete suggestions.
9589
+ */
9590
+ async autocomplete(query, options = {}) {
9591
+ return this.client.request("/v1/wallapop/autocomplete", {
9592
+ params: { query, market: options.market }
9593
+ });
9594
+ }
9595
+ /**
9596
+ * Get the full category tree; ids are usable as the search `categoryId`.
9597
+ *
9598
+ * Costs 1 credit.
9599
+ *
9600
+ * @param options - Optional parameters (market — localises names).
9601
+ * @returns Category tree.
9602
+ */
9603
+ async listCategories(options = {}) {
9604
+ return this.client.request("/v1/wallapop/categories", {
9605
+ params: { market: options.market }
9606
+ });
9607
+ }
9608
+ /**
9609
+ * Get the search filters Wallapop offers for a category and/or query,
9610
+ * with their option ids.
9611
+ *
9612
+ * Costs 2 credits.
9613
+ *
9614
+ * @param options - Optional parameters (categoryId, query, market).
9615
+ * @returns Available filters.
9616
+ */
9617
+ async listFilters(options = {}) {
9618
+ return this.client.request("/v1/wallapop/filters", {
9619
+ params: {
9620
+ category_id: options.categoryId,
9621
+ query: options.query,
9622
+ market: options.market
9623
+ }
9624
+ });
9625
+ }
9626
+ /**
9627
+ * Get a filter's long option list (brands, models) that Wallapop serves
9628
+ * separately — filters flagged `options_endpoint` in `listFilters`.
9629
+ *
9630
+ * Costs 2 credits.
9631
+ *
9632
+ * @param filterId - Filter id, e.g. "brand".
9633
+ * @param options - Optional parameters (categoryId, query, market).
9634
+ * @returns The filter's options.
9635
+ * @throws ValidationError - If the filter id is invalid.
9636
+ */
9637
+ async listFilterOptions(filterId, options = {}) {
9638
+ return this.client.request(
9639
+ `/v1/wallapop/filters/${encodeURIComponent(filterId)}/options`,
9640
+ {
9641
+ params: {
9642
+ category_id: options.categoryId,
9643
+ query: options.query,
9644
+ market: options.market
9645
+ }
9646
+ }
9647
+ );
9648
+ }
9649
+ /**
9650
+ * Get all supported Wallapop markets and their default search location.
9651
+ *
9652
+ * Free — this endpoint costs no credits.
9653
+ *
9654
+ * @returns Markets response with all supported markets.
9655
+ */
9656
+ async listMarkets() {
9657
+ return this.client.request("/v1/wallapop/markets");
9658
+ }
9659
+ };
9660
+
9342
9661
  // src/linkedin/client.ts
9343
9662
  var LinkedInClient = class {
9344
9663
  client;
@@ -9831,6 +10150,8 @@ var ScrapeBadger = class {
9831
10150
  facebook;
9832
10151
  /** Walmart scraper API client — 11 endpoints (walmart.com, US-only) */
9833
10152
  walmart;
10153
+ /** Gumtree scraper API client — 8 endpoints (gumtree.com, UK-only) */
10154
+ gumtree;
9834
10155
  /** DuckDuckGo scraper API client — search, images, news, videos, autocomplete, instant, regions */
9835
10156
  duckduckgo;
9836
10157
  /** Bing scraper API client — 6 endpoints (search, images, videos, news, autocomplete, markets) */
@@ -9861,6 +10182,8 @@ var ScrapeBadger = class {
9861
10182
  perplexity;
9862
10183
  /** Depop scraper API client — search, product, user, user products, markets (www.depop.com, 10 markets) */
9863
10184
  depop;
10185
+ /** Wallapop scraper API client — search, item, user, user items/reviews, autocomplete, categories, filters, markets (es, it, pt) */
10186
+ wallapop;
9864
10187
  /** LinkedIn scraper API client — 11 no-auth endpoints (jobs, company, school, profile, post, article, learning, geo) */
9865
10188
  linkedin;
9866
10189
  /** ChatGPT scraper API client — ask, brand visibility, models (the real chatgpt.com, anonymous) */
@@ -9920,6 +10243,7 @@ var ScrapeBadger = class {
9920
10243
  this.ebay = new EbayClient(this.baseClient);
9921
10244
  this.facebook = new FacebookClient(this.baseClient);
9922
10245
  this.walmart = new WalmartClient(this.baseClient);
10246
+ this.gumtree = new GumtreeClient(this.baseClient);
9923
10247
  this.duckduckgo = new DuckDuckGoClient(this.baseClient);
9924
10248
  this.bing = new BingClient(this.baseClient);
9925
10249
  this.booking = new BookingClient(this.baseClient);
@@ -9935,6 +10259,7 @@ var ScrapeBadger = class {
9935
10259
  this.loopnet = new LoopNetClient(this.baseClient);
9936
10260
  this.perplexity = new PerplexityClient(this.baseClient);
9937
10261
  this.depop = new DepopClient(this.baseClient);
10262
+ this.wallapop = new WallapopClient(this.baseClient);
9938
10263
  this.linkedin = new LinkedInClient(this.baseClient);
9939
10264
  this.chatgpt = new ChatGPTClient(this.baseClient);
9940
10265
  this.gemini = new GeminiClient(this.baseClient);
@@ -9997,6 +10322,7 @@ exports.GoogleShoppingClient = ShoppingClient;
9997
10322
  exports.GoogleShortsClient = ShortsClient;
9998
10323
  exports.GoogleTrendsClient = TrendsClient2;
9999
10324
  exports.GoogleVideosClient = VideosClient;
10325
+ exports.GumtreeClient = GumtreeClient;
10000
10326
  exports.IPNotAllowedError = IPNotAllowedError;
10001
10327
  exports.ImmobiliareClient = ImmobiliareClient;
10002
10328
  exports.InstagramAudioClient = AudioClient;
@@ -10071,6 +10397,7 @@ exports.VintedItemsClient = ItemsClient;
10071
10397
  exports.VintedReferenceClient = ReferenceClient;
10072
10398
  exports.VintedSearchClient = SearchClient;
10073
10399
  exports.VintedUsersClient = UsersClient2;
10400
+ exports.WallapopClient = WallapopClient;
10074
10401
  exports.WalmartClient = WalmartClient;
10075
10402
  exports.WalmartProductsClient = ProductsClient4;
10076
10403
  exports.WalmartReferenceClient = ReferenceClient6;