scrapebadger 0.58.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 -0
- package/dist/index.d.cts +573 -1
- package/dist/index.d.ts +573 -1
- package/dist/index.js +154 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -2
- 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 {
|
|
@@ -6523,6 +6523,155 @@ var WalmartClient = class {
|
|
|
6523
6523
|
}
|
|
6524
6524
|
};
|
|
6525
6525
|
|
|
6526
|
+
// src/gumtree/client.ts
|
|
6527
|
+
var GumtreeClient = class {
|
|
6528
|
+
constructor(client) {
|
|
6529
|
+
this.client = client;
|
|
6530
|
+
}
|
|
6531
|
+
/**
|
|
6532
|
+
* Search Gumtree listings in the UK, Australia or South Africa.
|
|
6533
|
+
*
|
|
6534
|
+
* @param params - Optional query, category, location (+ distance radius),
|
|
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`.
|
|
6540
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
6541
|
+
* @throws ValidationError - If the parameters are invalid, or not supported
|
|
6542
|
+
* by the market.
|
|
6543
|
+
*/
|
|
6544
|
+
async search(params = {}) {
|
|
6545
|
+
return this.client.request("/v1/gumtree/search", {
|
|
6546
|
+
params: {
|
|
6547
|
+
query: params.query,
|
|
6548
|
+
category: params.category,
|
|
6549
|
+
location: params.location,
|
|
6550
|
+
distance: params.distance,
|
|
6551
|
+
min_price: params.min_price,
|
|
6552
|
+
max_price: params.max_price,
|
|
6553
|
+
sort: params.sort,
|
|
6554
|
+
seller_type: params.seller_type,
|
|
6555
|
+
urgent_only: params.urgent_only,
|
|
6556
|
+
with_photos: params.with_photos,
|
|
6557
|
+
filters: params.filters,
|
|
6558
|
+
page: params.page,
|
|
6559
|
+
market: params.market
|
|
6560
|
+
}
|
|
6561
|
+
});
|
|
6562
|
+
}
|
|
6563
|
+
/**
|
|
6564
|
+
* The filters, sort orders and radius options Gumtree offers for a category.
|
|
6565
|
+
*
|
|
6566
|
+
* Each filter lists its values with live result counts. Feed a `key` and a
|
|
6567
|
+
* `value` back into {@link search} as `filters: "key:value"`.
|
|
6568
|
+
*
|
|
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.
|
|
6572
|
+
*/
|
|
6573
|
+
async searchFilters(params = {}) {
|
|
6574
|
+
return this.client.request("/v1/gumtree/search/filters", {
|
|
6575
|
+
params: {
|
|
6576
|
+
category: params.category,
|
|
6577
|
+
location: params.location,
|
|
6578
|
+
query: params.query,
|
|
6579
|
+
filters: params.filters,
|
|
6580
|
+
market: params.market
|
|
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 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).
|
|
6592
|
+
* @throws NotFoundError - If the listing does not exist or has expired.
|
|
6593
|
+
*/
|
|
6594
|
+
async getListing(listingId, options = {}) {
|
|
6595
|
+
return this.client.request(`/v1/gumtree/listings/${listingId}`, {
|
|
6596
|
+
params: { market: options.market }
|
|
6597
|
+
});
|
|
6598
|
+
}
|
|
6599
|
+
/**
|
|
6600
|
+
* Every live listing by the seller of `listingId`. Gumtree keys a seller's
|
|
6601
|
+
* ad list by one of their ads, so any listing id of theirs works.
|
|
6602
|
+
*
|
|
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 }`.
|
|
6606
|
+
*/
|
|
6607
|
+
async getSellerListings(listingId, options = {}) {
|
|
6608
|
+
const { page, market } = typeof options === "number" ? { page: options } : options;
|
|
6609
|
+
return this.client.request(
|
|
6610
|
+
`/v1/gumtree/listings/${listingId}/seller-listings`,
|
|
6611
|
+
{ params: { page, market } }
|
|
6612
|
+
);
|
|
6613
|
+
}
|
|
6614
|
+
/**
|
|
6615
|
+
* Gumtree search-box keyword suggestions, each with the category it maps to.
|
|
6616
|
+
*
|
|
6617
|
+
* @param query - Partial search term, e.g. `"iph"`.
|
|
6618
|
+
* @param options - Optional parameters (market).
|
|
6619
|
+
*/
|
|
6620
|
+
async autocomplete(query, options = {}) {
|
|
6621
|
+
return this.client.request("/v1/gumtree/autocomplete", {
|
|
6622
|
+
params: { query, market: options.market }
|
|
6623
|
+
});
|
|
6624
|
+
}
|
|
6625
|
+
/**
|
|
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`.
|
|
6628
|
+
*
|
|
6629
|
+
* @param query - Town, area or postcode prefix (min 2 chars), e.g. `"manch"` or `"SW1A"`.
|
|
6630
|
+
* @param options - Optional parameters (market).
|
|
6631
|
+
*/
|
|
6632
|
+
async locationAutocomplete(query, options = {}) {
|
|
6633
|
+
return this.client.request(
|
|
6634
|
+
"/v1/gumtree/locations/autocomplete",
|
|
6635
|
+
{ params: { query, market: options.market } }
|
|
6636
|
+
);
|
|
6637
|
+
}
|
|
6638
|
+
/**
|
|
6639
|
+
* Browse Gumtree's location tree. uk: UK -> nations -> counties -> towns;
|
|
6640
|
+
* au: states -> regions -> areas; za: provinces -> towns.
|
|
6641
|
+
*
|
|
6642
|
+
* @param options - Location id to list the children of, or
|
|
6643
|
+
* `{ parent_id, market }`. Unset = the market's root (the whole country).
|
|
6644
|
+
*/
|
|
6645
|
+
async listLocations(options = {}) {
|
|
6646
|
+
return this.client.request("/v1/gumtree/locations", {
|
|
6647
|
+
params: treeParams(options)
|
|
6648
|
+
});
|
|
6649
|
+
}
|
|
6650
|
+
/**
|
|
6651
|
+
* Browse Gumtree's category tree. A node's `slug` (uk) or `id` (au/za) is
|
|
6652
|
+
* the {@link search} category.
|
|
6653
|
+
*
|
|
6654
|
+
* @param options - Category id to list the children of, or
|
|
6655
|
+
* `{ parent_id, market }`. Unset = the market's root (all categories).
|
|
6656
|
+
*/
|
|
6657
|
+
async listCategories(options = {}) {
|
|
6658
|
+
return this.client.request("/v1/gumtree/categories", {
|
|
6659
|
+
params: treeParams(options)
|
|
6660
|
+
});
|
|
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
|
+
}
|
|
6669
|
+
};
|
|
6670
|
+
function treeParams(options) {
|
|
6671
|
+
const { parent_id, market } = typeof options === "number" ? { parent_id: options } : options;
|
|
6672
|
+
return { parent_id, market };
|
|
6673
|
+
}
|
|
6674
|
+
|
|
6526
6675
|
// src/duckduckgo/search.ts
|
|
6527
6676
|
var SearchClient10 = class {
|
|
6528
6677
|
constructor(client) {
|
|
@@ -10023,6 +10172,8 @@ var ScrapeBadger = class {
|
|
|
10023
10172
|
facebook;
|
|
10024
10173
|
/** Walmart scraper API client — 11 endpoints (walmart.com, US-only) */
|
|
10025
10174
|
walmart;
|
|
10175
|
+
/** Gumtree scraper API client — 9 endpoints (gumtree.com, gumtree.com.au, gumtree.co.za) */
|
|
10176
|
+
gumtree;
|
|
10026
10177
|
/** DuckDuckGo scraper API client — search, images, news, videos, autocomplete, instant, regions */
|
|
10027
10178
|
duckduckgo;
|
|
10028
10179
|
/** Bing scraper API client — 6 endpoints (search, images, videos, news, autocomplete, markets) */
|
|
@@ -10114,6 +10265,7 @@ var ScrapeBadger = class {
|
|
|
10114
10265
|
this.ebay = new EbayClient(this.baseClient);
|
|
10115
10266
|
this.facebook = new FacebookClient(this.baseClient);
|
|
10116
10267
|
this.walmart = new WalmartClient(this.baseClient);
|
|
10268
|
+
this.gumtree = new GumtreeClient(this.baseClient);
|
|
10117
10269
|
this.duckduckgo = new DuckDuckGoClient(this.baseClient);
|
|
10118
10270
|
this.bing = new BingClient(this.baseClient);
|
|
10119
10271
|
this.booking = new BookingClient(this.baseClient);
|
|
@@ -10136,6 +10288,6 @@ var ScrapeBadger = class {
|
|
|
10136
10288
|
}
|
|
10137
10289
|
};
|
|
10138
10290
|
|
|
10139
|
-
export { AccountRestrictedError, AmazonClient, ListingsClient as AmazonListingsClient, ProductsClient2 as AmazonProductsClient, ReferenceClient2 as AmazonReferenceClient, SearchClient5 as AmazonSearchClient, SellersClient as AmazonSellersClient, ApartmentsClient, AuthenticationError, BaiduClient, BingClient, MediaClient3 as BingMediaClient, NewsClient2 as BingNewsClient, ReferenceClient8 as BingReferenceClient, SearchClient11 as BingSearchClient, AskClient as ChatGPTAskClient, BrandClient as ChatGPTBrandClient, ChatGPTClient, ReferenceClient16 as ChatGPTReferenceClient, CommunitiesClient, ConflictError, DepopClient, DuckDuckGoClient, MediaClient2 as DuckDuckGoMediaClient, ReferenceClient7 as DuckDuckGoReferenceClient, SearchClient10 as DuckDuckGoSearchClient, CategoriesClient as EbayCategoriesClient, EbayClient, ItemsClient2 as EbayItemsClient, ReferenceClient5 as EbayReferenceClient, SearchClient8 as EbaySearchClient, SellersClient2 as EbaySellersClient, AskClient2 as GeminiAskClient, BrandClient2 as GeminiBrandClient, GeminiClient, GeoClient, AdsClient as GoogleAdsClient, AiModeClient as GoogleAiModeClient, AutocompleteClient as GoogleAutocompleteClient, GoogleClient, FinanceClient as GoogleFinanceClient, FlightsClient as GoogleFlightsClient, HotelsClient as GoogleHotelsClient, ImagesClient as GoogleImagesClient, JobsClient as GoogleJobsClient, LensClient as GoogleLensClient, MapsClient as GoogleMapsClient, NewsClient as GoogleNewsClient, PatentsClient as GooglePatentsClient, ProductsClient as GoogleProductsClient, ScholarClient as GoogleScholarClient, SearchClient2 as GoogleSearchClient, ShoppingClient as GoogleShoppingClient, ShortsClient as GoogleShortsClient, TrendsClient2 as GoogleTrendsClient, VideosClient as GoogleVideosClient, IPNotAllowedError, ImmobiliareClient, AudioClient as InstagramAudioClient, InstagramClient, HashtagsClient as InstagramHashtagsClient, LocationsClient as InstagramLocationsClient, MediaClient as InstagramMediaClient, SearchClient4 as InstagramSearchClient, UsersClient4 as InstagramUsersClient, InsufficientCreditsError, AdsClient3 as LeboncoinAdsClient, LeboncoinClient, ReferenceClient13 as LeboncoinReferenceClient, SearchClient17 as LeboncoinSearchClient, SellersClient4 as LeboncoinSellersClient, LinkedInClient, ListsClient, BrokersClient as LoopNetBrokersClient, LoopNetClient, ListingsClient2 as LoopNetListingsClient, ReferenceClient15 as LoopNetReferenceClient, SearchClient19 as LoopNetSearchClient, NaverClient, ContentClient as NaverContentClient, PlacesClient as NaverPlacesClient, ProductsClient5 as NaverProductsClient, ReviewsClient2 as NaverReviewsClient, SearchClient12 as NaverSearchClient, ShoppingClient2 as NaverShoppingClient, ShoppingLiveClient as NaverShoppingLiveClient, StoresClient2 as NaverStoresClient, NotFoundError, PermissionDeniedError, RateLimitError, RealtorClient, PropertiesClient as RealtorPropertiesClient, ReferenceClient12 as RealtorReferenceClient, SearchClient16 as RealtorSearchClient, RedditClient, PostsClient as RedditPostsClient, SearchClient3 as RedditSearchClient, SubredditsClient as RedditSubredditsClient, UsersClient3 as RedditUsersClient, RedfinClient, ScrapeBadger, ScrapeBadgerError, ServerError, ShopeeClient, ProductsClient3 as ShopeeProductsClient, ReferenceClient3 as ShopeeReferenceClient, ReviewsClient as ShopeeReviewsClient, SearchClient6 as ShopeeSearchClient, SpacesClient, StreamClient, AdsClient2 as TikTokAdsClient, TikTokClient, HashtagsClient2 as TikTokHashtagsClient, MusicClient as TikTokMusicClient, ReferenceClient4 as TikTokReferenceClient, SearchClient7 as TikTokSearchClient, TrendingClient as TikTokTrendingClient, UsersClient5 as TikTokUsersClient, VideosClient2 as TikTokVideosClient, TimeoutError, TrendsClient, TweetsClient, TwitterClient, UsersClient, ValidationError, VintedClient, ItemsClient as VintedItemsClient, ReferenceClient as VintedReferenceClient, SearchClient as VintedSearchClient, UsersClient2 as VintedUsersClient, WallapopClient, WalmartClient, ProductsClient4 as WalmartProductsClient, ReferenceClient6 as WalmartReferenceClient, SearchClient9 as WalmartSearchClient, SellersClient3 as WalmartSellersClient, StoresClient as WalmartStoresClient, WebClient, WebSocketStreamError, YahooClient, MediaClient4 as YahooMediaClient, NewsClient3 as YahooNewsClient, ReferenceClient9 as YahooReferenceClient, SearchClient13 as YahooSearchClient, YandexClient, ImagesClient2 as YandexImagesClient, ReferenceClient10 as YandexReferenceClient, SearchClient14 as YandexSearchClient, ChannelsClient as YoutubeChannelsClient, YoutubeClient, CommunityClient as YoutubeCommunityClient, MusicClient2 as YoutubeMusicClient, PlaylistsClient as YoutubePlaylistsClient, ReferenceClient11 as YoutubeReferenceClient, SearchClient15 as YoutubeSearchClient, ShortsClient2 as YoutubeShortsClient, TrendingClient2 as YoutubeTrendingClient, VideosClient3 as YoutubeVideosClient, AgentClient as ZillowAgentClient, ZillowClient, PropertiesClient2 as ZillowPropertiesClient, ReferenceClient14 as ZillowReferenceClient, SearchClient18 as ZillowSearchClient, collectAll, verifyWebhookSignature };
|
|
10291
|
+
export { AccountRestrictedError, AmazonClient, ListingsClient as AmazonListingsClient, ProductsClient2 as AmazonProductsClient, ReferenceClient2 as AmazonReferenceClient, SearchClient5 as AmazonSearchClient, SellersClient as AmazonSellersClient, ApartmentsClient, AuthenticationError, BaiduClient, BingClient, MediaClient3 as BingMediaClient, NewsClient2 as BingNewsClient, ReferenceClient8 as BingReferenceClient, SearchClient11 as BingSearchClient, AskClient as ChatGPTAskClient, BrandClient as ChatGPTBrandClient, ChatGPTClient, ReferenceClient16 as ChatGPTReferenceClient, CommunitiesClient, ConflictError, DepopClient, DuckDuckGoClient, MediaClient2 as DuckDuckGoMediaClient, ReferenceClient7 as DuckDuckGoReferenceClient, SearchClient10 as DuckDuckGoSearchClient, CategoriesClient as EbayCategoriesClient, EbayClient, ItemsClient2 as EbayItemsClient, ReferenceClient5 as EbayReferenceClient, SearchClient8 as EbaySearchClient, SellersClient2 as EbaySellersClient, AskClient2 as GeminiAskClient, BrandClient2 as GeminiBrandClient, GeminiClient, GeoClient, AdsClient as GoogleAdsClient, AiModeClient as GoogleAiModeClient, AutocompleteClient as GoogleAutocompleteClient, GoogleClient, FinanceClient as GoogleFinanceClient, FlightsClient as GoogleFlightsClient, HotelsClient as GoogleHotelsClient, ImagesClient as GoogleImagesClient, JobsClient as GoogleJobsClient, LensClient as GoogleLensClient, MapsClient as GoogleMapsClient, NewsClient as GoogleNewsClient, PatentsClient as GooglePatentsClient, ProductsClient as GoogleProductsClient, ScholarClient as GoogleScholarClient, SearchClient2 as GoogleSearchClient, ShoppingClient as GoogleShoppingClient, ShortsClient as GoogleShortsClient, TrendsClient2 as GoogleTrendsClient, VideosClient as GoogleVideosClient, GumtreeClient, IPNotAllowedError, ImmobiliareClient, AudioClient as InstagramAudioClient, InstagramClient, HashtagsClient as InstagramHashtagsClient, LocationsClient as InstagramLocationsClient, MediaClient as InstagramMediaClient, SearchClient4 as InstagramSearchClient, UsersClient4 as InstagramUsersClient, InsufficientCreditsError, AdsClient3 as LeboncoinAdsClient, LeboncoinClient, ReferenceClient13 as LeboncoinReferenceClient, SearchClient17 as LeboncoinSearchClient, SellersClient4 as LeboncoinSellersClient, LinkedInClient, ListsClient, BrokersClient as LoopNetBrokersClient, LoopNetClient, ListingsClient2 as LoopNetListingsClient, ReferenceClient15 as LoopNetReferenceClient, SearchClient19 as LoopNetSearchClient, NaverClient, ContentClient as NaverContentClient, PlacesClient as NaverPlacesClient, ProductsClient5 as NaverProductsClient, ReviewsClient2 as NaverReviewsClient, SearchClient12 as NaverSearchClient, ShoppingClient2 as NaverShoppingClient, ShoppingLiveClient as NaverShoppingLiveClient, StoresClient2 as NaverStoresClient, NotFoundError, PermissionDeniedError, RateLimitError, RealtorClient, PropertiesClient as RealtorPropertiesClient, ReferenceClient12 as RealtorReferenceClient, SearchClient16 as RealtorSearchClient, RedditClient, PostsClient as RedditPostsClient, SearchClient3 as RedditSearchClient, SubredditsClient as RedditSubredditsClient, UsersClient3 as RedditUsersClient, RedfinClient, ScrapeBadger, ScrapeBadgerError, ServerError, ShopeeClient, ProductsClient3 as ShopeeProductsClient, ReferenceClient3 as ShopeeReferenceClient, ReviewsClient as ShopeeReviewsClient, SearchClient6 as ShopeeSearchClient, SpacesClient, StreamClient, AdsClient2 as TikTokAdsClient, TikTokClient, HashtagsClient2 as TikTokHashtagsClient, MusicClient as TikTokMusicClient, ReferenceClient4 as TikTokReferenceClient, SearchClient7 as TikTokSearchClient, TrendingClient as TikTokTrendingClient, UsersClient5 as TikTokUsersClient, VideosClient2 as TikTokVideosClient, TimeoutError, TrendsClient, TweetsClient, TwitterClient, UsersClient, ValidationError, VintedClient, ItemsClient as VintedItemsClient, ReferenceClient as VintedReferenceClient, SearchClient as VintedSearchClient, UsersClient2 as VintedUsersClient, WallapopClient, WalmartClient, ProductsClient4 as WalmartProductsClient, ReferenceClient6 as WalmartReferenceClient, SearchClient9 as WalmartSearchClient, SellersClient3 as WalmartSellersClient, StoresClient as WalmartStoresClient, WebClient, WebSocketStreamError, YahooClient, MediaClient4 as YahooMediaClient, NewsClient3 as YahooNewsClient, ReferenceClient9 as YahooReferenceClient, SearchClient13 as YahooSearchClient, YandexClient, ImagesClient2 as YandexImagesClient, ReferenceClient10 as YandexReferenceClient, SearchClient14 as YandexSearchClient, ChannelsClient as YoutubeChannelsClient, YoutubeClient, CommunityClient as YoutubeCommunityClient, MusicClient2 as YoutubeMusicClient, PlaylistsClient as YoutubePlaylistsClient, ReferenceClient11 as YoutubeReferenceClient, SearchClient15 as YoutubeSearchClient, ShortsClient2 as YoutubeShortsClient, TrendingClient2 as YoutubeTrendingClient, VideosClient3 as YoutubeVideosClient, AgentClient as ZillowAgentClient, ZillowClient, PropertiesClient2 as ZillowPropertiesClient, ReferenceClient14 as ZillowReferenceClient, SearchClient18 as ZillowSearchClient, collectAll, verifyWebhookSignature };
|
|
10140
10292
|
//# sourceMappingURL=index.mjs.map
|
|
10141
10293
|
//# sourceMappingURL=index.mjs.map
|