scrapebadger 0.59.0 → 0.60.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 +1 -1
- package/dist/index.d.cts +182 -57
- package/dist/index.d.ts +182 -57
- package/dist/index.js +63 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import WebSocket from 'ws';
|
|
4
4
|
|
|
5
5
|
// src/internal/version.ts
|
|
6
|
-
var SDK_VERSION = "0.
|
|
6
|
+
var SDK_VERSION = "0.60.0";
|
|
7
7
|
|
|
8
8
|
// src/internal/exceptions.ts
|
|
9
9
|
var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
|
|
@@ -6529,15 +6529,17 @@ var GumtreeClient = class {
|
|
|
6529
6529
|
this.client = client;
|
|
6530
6530
|
}
|
|
6531
6531
|
/**
|
|
6532
|
-
* Search
|
|
6532
|
+
* Search Gumtree listings in the UK, Australia or South Africa.
|
|
6533
6533
|
*
|
|
6534
6534
|
* @param params - Optional query, category, location (+ distance radius),
|
|
6535
|
-
* price, sort, seller type, urgent/photo flags
|
|
6536
|
-
*
|
|
6537
|
-
* @returns ~25-30 listings per page
|
|
6538
|
-
*
|
|
6535
|
+
* price, sort, seller type, urgent/photo flags (uk only),
|
|
6536
|
+
* category-specific filters, page (1-50) and market.
|
|
6537
|
+
* @returns uk ~25-30 listings per page (Gumtree pins up to 5 paid featured
|
|
6538
|
+
* ads, `is_featured`, above the chosen sort order), au 24, za 20. Prices
|
|
6539
|
+
* are in `currency`.
|
|
6539
6540
|
* @throws AuthenticationError - If the API key is invalid.
|
|
6540
|
-
* @throws ValidationError - If the parameters are invalid
|
|
6541
|
+
* @throws ValidationError - If the parameters are invalid, or not supported
|
|
6542
|
+
* by the market.
|
|
6541
6543
|
*/
|
|
6542
6544
|
async search(params = {}) {
|
|
6543
6545
|
return this.client.request("/v1/gumtree/search", {
|
|
@@ -6553,7 +6555,8 @@ var GumtreeClient = class {
|
|
|
6553
6555
|
urgent_only: params.urgent_only,
|
|
6554
6556
|
with_photos: params.with_photos,
|
|
6555
6557
|
filters: params.filters,
|
|
6556
|
-
page: params.page
|
|
6558
|
+
page: params.page,
|
|
6559
|
+
market: params.market
|
|
6557
6560
|
}
|
|
6558
6561
|
});
|
|
6559
6562
|
}
|
|
@@ -6563,15 +6566,18 @@ var GumtreeClient = class {
|
|
|
6563
6566
|
* Each filter lists its values with live result counts. Feed a `key` and a
|
|
6564
6567
|
* `value` back into {@link search} as `filters: "key:value"`.
|
|
6565
6568
|
*
|
|
6566
|
-
* @param params - Optional category (default `"all"`), location (default
|
|
6567
|
-
*
|
|
6569
|
+
* @param params - Optional category (default `"all"`), location (default:
|
|
6570
|
+
* the whole country), query to scope the counts, already-applied
|
|
6571
|
+
* `filters` (za only) and market.
|
|
6568
6572
|
*/
|
|
6569
6573
|
async searchFilters(params = {}) {
|
|
6570
6574
|
return this.client.request("/v1/gumtree/search/filters", {
|
|
6571
6575
|
params: {
|
|
6572
6576
|
category: params.category,
|
|
6573
6577
|
location: params.location,
|
|
6574
|
-
query: params.query
|
|
6578
|
+
query: params.query,
|
|
6579
|
+
filters: params.filters,
|
|
6580
|
+
market: params.market
|
|
6575
6581
|
}
|
|
6576
6582
|
});
|
|
6577
6583
|
}
|
|
@@ -6579,70 +6585,92 @@ var GumtreeClient = class {
|
|
|
6579
6585
|
* Full listing: description, every attribute, images, location, seller and
|
|
6580
6586
|
* similar ads. Motors listings carry the full vehicle spec.
|
|
6581
6587
|
*
|
|
6582
|
-
* @param listingId - Gumtree listing id — the number at the end of
|
|
6583
|
-
*
|
|
6588
|
+
* @param listingId - Gumtree listing id — the number at the end of the
|
|
6589
|
+
* listing URL (uk/au: ~10 digits; za: the full 26-digit ad id, not the
|
|
6590
|
+
* short one).
|
|
6591
|
+
* @param options - Optional parameters (market).
|
|
6584
6592
|
* @throws NotFoundError - If the listing does not exist or has expired.
|
|
6585
6593
|
*/
|
|
6586
|
-
async getListing(listingId) {
|
|
6587
|
-
return this.client.request(`/v1/gumtree/listings/${listingId}
|
|
6594
|
+
async getListing(listingId, options = {}) {
|
|
6595
|
+
return this.client.request(`/v1/gumtree/listings/${listingId}`, {
|
|
6596
|
+
params: { market: options.market }
|
|
6597
|
+
});
|
|
6588
6598
|
}
|
|
6589
6599
|
/**
|
|
6590
6600
|
* Every live listing by the seller of `listingId`. Gumtree keys a seller's
|
|
6591
6601
|
* ad list by one of their ads, so any listing id of theirs works.
|
|
6592
6602
|
*
|
|
6593
|
-
* @param listingId - Any Gumtree listing id belonging to the seller
|
|
6594
|
-
*
|
|
6603
|
+
* @param listingId - Any Gumtree listing id belonging to the seller (za: the
|
|
6604
|
+
* 26-digit id).
|
|
6605
|
+
* @param options - Page number (1-50), or `{ page, market }`.
|
|
6595
6606
|
*/
|
|
6596
|
-
async getSellerListings(listingId,
|
|
6607
|
+
async getSellerListings(listingId, options = {}) {
|
|
6608
|
+
const { page, market } = typeof options === "number" ? { page: options } : options;
|
|
6597
6609
|
return this.client.request(
|
|
6598
6610
|
`/v1/gumtree/listings/${listingId}/seller-listings`,
|
|
6599
|
-
{ params: { page } }
|
|
6611
|
+
{ params: { page, market } }
|
|
6600
6612
|
);
|
|
6601
6613
|
}
|
|
6602
6614
|
/**
|
|
6603
6615
|
* Gumtree search-box keyword suggestions, each with the category it maps to.
|
|
6604
6616
|
*
|
|
6605
6617
|
* @param query - Partial search term, e.g. `"iph"`.
|
|
6618
|
+
* @param options - Optional parameters (market).
|
|
6606
6619
|
*/
|
|
6607
|
-
async autocomplete(query) {
|
|
6620
|
+
async autocomplete(query, options = {}) {
|
|
6608
6621
|
return this.client.request("/v1/gumtree/autocomplete", {
|
|
6609
|
-
params: { query }
|
|
6622
|
+
params: { query, market: options.market }
|
|
6610
6623
|
});
|
|
6611
6624
|
}
|
|
6612
6625
|
/**
|
|
6613
|
-
* Resolve a place name or postcode prefix to Gumtree locations
|
|
6626
|
+
* Resolve a place name or postcode prefix to Gumtree locations. The `id`
|
|
6627
|
+
* (au/za) or `name` (uk) is what {@link search} takes as `location`.
|
|
6614
6628
|
*
|
|
6615
6629
|
* @param query - Town, area or postcode prefix (min 2 chars), e.g. `"manch"` or `"SW1A"`.
|
|
6630
|
+
* @param options - Optional parameters (market).
|
|
6616
6631
|
*/
|
|
6617
|
-
async locationAutocomplete(query) {
|
|
6632
|
+
async locationAutocomplete(query, options = {}) {
|
|
6618
6633
|
return this.client.request(
|
|
6619
6634
|
"/v1/gumtree/locations/autocomplete",
|
|
6620
|
-
{ params: { query } }
|
|
6635
|
+
{ params: { query, market: options.market } }
|
|
6621
6636
|
);
|
|
6622
6637
|
}
|
|
6623
6638
|
/**
|
|
6624
|
-
* Browse Gumtree's location tree: UK -> nations -> counties -> towns
|
|
6639
|
+
* Browse Gumtree's location tree. uk: UK -> nations -> counties -> towns;
|
|
6640
|
+
* au: states -> regions -> areas; za: provinces -> towns.
|
|
6625
6641
|
*
|
|
6626
|
-
* @param
|
|
6627
|
-
*
|
|
6642
|
+
* @param options - Location id to list the children of, or
|
|
6643
|
+
* `{ parent_id, market }`. Unset = the market's root (the whole country).
|
|
6628
6644
|
*/
|
|
6629
|
-
async listLocations(
|
|
6645
|
+
async listLocations(options = {}) {
|
|
6630
6646
|
return this.client.request("/v1/gumtree/locations", {
|
|
6631
|
-
params:
|
|
6647
|
+
params: treeParams(options)
|
|
6632
6648
|
});
|
|
6633
6649
|
}
|
|
6634
6650
|
/**
|
|
6635
|
-
* Browse Gumtree's category tree. A node's `slug`
|
|
6651
|
+
* Browse Gumtree's category tree. A node's `slug` (uk) or `id` (au/za) is
|
|
6652
|
+
* the {@link search} category.
|
|
6636
6653
|
*
|
|
6637
|
-
* @param
|
|
6638
|
-
*
|
|
6654
|
+
* @param options - Category id to list the children of, or
|
|
6655
|
+
* `{ parent_id, market }`. Unset = the market's root (all categories).
|
|
6639
6656
|
*/
|
|
6640
|
-
async listCategories(
|
|
6657
|
+
async listCategories(options = {}) {
|
|
6641
6658
|
return this.client.request("/v1/gumtree/categories", {
|
|
6642
|
-
params:
|
|
6659
|
+
params: treeParams(options)
|
|
6643
6660
|
});
|
|
6644
6661
|
}
|
|
6662
|
+
/**
|
|
6663
|
+
* The Gumtree sites this API covers (`uk`, `au`, `za`), with their domain,
|
|
6664
|
+
* currency, distance unit, page size and id format.
|
|
6665
|
+
*/
|
|
6666
|
+
async listMarkets() {
|
|
6667
|
+
return this.client.request("/v1/gumtree/markets");
|
|
6668
|
+
}
|
|
6645
6669
|
};
|
|
6670
|
+
function treeParams(options) {
|
|
6671
|
+
const { parent_id, market } = typeof options === "number" ? { parent_id: options } : options;
|
|
6672
|
+
return { parent_id, market };
|
|
6673
|
+
}
|
|
6646
6674
|
|
|
6647
6675
|
// src/duckduckgo/search.ts
|
|
6648
6676
|
var SearchClient10 = class {
|
|
@@ -10144,7 +10172,7 @@ var ScrapeBadger = class {
|
|
|
10144
10172
|
facebook;
|
|
10145
10173
|
/** Walmart scraper API client — 11 endpoints (walmart.com, US-only) */
|
|
10146
10174
|
walmart;
|
|
10147
|
-
/** Gumtree scraper API client —
|
|
10175
|
+
/** Gumtree scraper API client — 9 endpoints (gumtree.com, gumtree.com.au, gumtree.co.za) */
|
|
10148
10176
|
gumtree;
|
|
10149
10177
|
/** DuckDuckGo scraper API client — search, images, news, videos, autocomplete, instant, regions */
|
|
10150
10178
|
duckduckgo;
|