scrapebadger 0.59.0 → 0.60.1
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 +215 -68
- package/dist/index.d.ts +215 -68
- package/dist/index.js +65 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -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.1";
|
|
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,94 @@ 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
|
|
6583
|
-
*
|
|
6588
|
+
* @param listingId - Gumtree listing id from the end of the listing URL
|
|
6589
|
+
* (uk/au: ~10 digits; za: the listing ref, e.g. `"ls26bvmcpnsqmz7l9jz"`).
|
|
6590
|
+
* @param options - Optional parameters (market).
|
|
6584
6591
|
* @throws NotFoundError - If the listing does not exist or has expired.
|
|
6585
6592
|
*/
|
|
6586
|
-
async getListing(listingId) {
|
|
6587
|
-
return this.client.request(`/v1/gumtree/listings/${listingId}
|
|
6593
|
+
async getListing(listingId, options = {}) {
|
|
6594
|
+
return this.client.request(`/v1/gumtree/listings/${listingId}`, {
|
|
6595
|
+
params: { market: options.market }
|
|
6596
|
+
});
|
|
6588
6597
|
}
|
|
6589
6598
|
/**
|
|
6590
6599
|
* Every live listing by the seller of `listingId`. Gumtree keys a seller's
|
|
6591
6600
|
* ad list by one of their ads, so any listing id of theirs works.
|
|
6592
6601
|
*
|
|
6593
|
-
* @param listingId - Any Gumtree listing id belonging to the seller
|
|
6594
|
-
*
|
|
6602
|
+
* @param listingId - Any Gumtree listing id belonging to the seller (za: a
|
|
6603
|
+
* listing ref, e.g. `"ls26bvmcpnsqmz7l9jz"`).
|
|
6604
|
+
* @param options - Page number (1-50), or `{ page, market }`.
|
|
6595
6605
|
*/
|
|
6596
|
-
async getSellerListings(listingId,
|
|
6606
|
+
async getSellerListings(listingId, options = {}) {
|
|
6607
|
+
const { page, market } = typeof options === "number" ? { page: options } : options;
|
|
6597
6608
|
return this.client.request(
|
|
6598
6609
|
`/v1/gumtree/listings/${listingId}/seller-listings`,
|
|
6599
|
-
{ params: { page } }
|
|
6610
|
+
{ params: { page, market } }
|
|
6600
6611
|
);
|
|
6601
6612
|
}
|
|
6602
6613
|
/**
|
|
6603
6614
|
* Gumtree search-box keyword suggestions, each with the category it maps to.
|
|
6604
6615
|
*
|
|
6605
6616
|
* @param query - Partial search term, e.g. `"iph"`.
|
|
6617
|
+
* @param options - Optional parameters (market).
|
|
6606
6618
|
*/
|
|
6607
|
-
async autocomplete(query) {
|
|
6619
|
+
async autocomplete(query, options = {}) {
|
|
6608
6620
|
return this.client.request("/v1/gumtree/autocomplete", {
|
|
6609
|
-
params: { query }
|
|
6621
|
+
params: { query, market: options.market }
|
|
6610
6622
|
});
|
|
6611
6623
|
}
|
|
6612
6624
|
/**
|
|
6613
|
-
* Resolve a place name or postcode prefix to Gumtree locations
|
|
6625
|
+
* Resolve a place name or postcode prefix to Gumtree locations. The `id`
|
|
6626
|
+
* (au: a number; za: a ref such as `"pfw8k"`) or `name` (uk) is what
|
|
6627
|
+
* {@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 and suburbs.
|
|
6625
6641
|
*
|
|
6626
|
-
* @param
|
|
6627
|
-
*
|
|
6642
|
+
* @param options - Location id (uk/au: a number; za: a ref such as
|
|
6643
|
+
* `"dkp8y"` for Gauteng) to list the children of, or
|
|
6644
|
+
* `{ parent_id, market }`. Unset = the market's root (the whole country).
|
|
6628
6645
|
*/
|
|
6629
|
-
async listLocations(
|
|
6646
|
+
async listLocations(options = {}) {
|
|
6630
6647
|
return this.client.request("/v1/gumtree/locations", {
|
|
6631
|
-
params:
|
|
6648
|
+
params: treeParams(options)
|
|
6632
6649
|
});
|
|
6633
6650
|
}
|
|
6634
6651
|
/**
|
|
6635
|
-
* Browse Gumtree's category tree. A node's `slug`
|
|
6652
|
+
* Browse Gumtree's category tree. A node's `slug` (uk) or `id` (au: a
|
|
6653
|
+
* number; za: a ref such as `"p6dnh"`) is the {@link search} category.
|
|
6636
6654
|
*
|
|
6637
|
-
* @param
|
|
6638
|
-
*
|
|
6655
|
+
* @param options - Category id (uk/au: a number; za: a ref such as
|
|
6656
|
+
* `"l4dq6"` for Vehicles) to list the children of, or
|
|
6657
|
+
* `{ parent_id, market }`. Unset = the market's root (all categories).
|
|
6639
6658
|
*/
|
|
6640
|
-
async listCategories(
|
|
6659
|
+
async listCategories(options = {}) {
|
|
6641
6660
|
return this.client.request("/v1/gumtree/categories", {
|
|
6642
|
-
params:
|
|
6661
|
+
params: treeParams(options)
|
|
6643
6662
|
});
|
|
6644
6663
|
}
|
|
6664
|
+
/**
|
|
6665
|
+
* The Gumtree sites this API covers (`uk`, `au`, `za`), with their domain,
|
|
6666
|
+
* currency, distance unit, page size and id format.
|
|
6667
|
+
*/
|
|
6668
|
+
async listMarkets() {
|
|
6669
|
+
return this.client.request("/v1/gumtree/markets");
|
|
6670
|
+
}
|
|
6645
6671
|
};
|
|
6672
|
+
function treeParams(options) {
|
|
6673
|
+
const { parent_id, market } = typeof options === "object" ? options : { parent_id: options };
|
|
6674
|
+
return { parent_id, market };
|
|
6675
|
+
}
|
|
6646
6676
|
|
|
6647
6677
|
// src/duckduckgo/search.ts
|
|
6648
6678
|
var SearchClient10 = class {
|
|
@@ -10144,7 +10174,7 @@ var ScrapeBadger = class {
|
|
|
10144
10174
|
facebook;
|
|
10145
10175
|
/** Walmart scraper API client — 11 endpoints (walmart.com, US-only) */
|
|
10146
10176
|
walmart;
|
|
10147
|
-
/** Gumtree scraper API client —
|
|
10177
|
+
/** Gumtree scraper API client — 9 endpoints (gumtree.com, gumtree.com.au, gumtree.co.za) */
|
|
10148
10178
|
gumtree;
|
|
10149
10179
|
/** DuckDuckGo scraper API client — search, images, news, videos, autocomplete, instant, regions */
|
|
10150
10180
|
duckduckgo;
|