scrapebadger 0.12.0 → 0.13.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 +2 -0
- package/dist/index.d.cts +1646 -34
- package/dist/index.d.ts +1646 -34
- package/dist/index.js +630 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +617 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,6 +8,9 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
8
8
|
|
|
9
9
|
var WebSocket__default = /*#__PURE__*/_interopDefault(WebSocket);
|
|
10
10
|
|
|
11
|
+
// src/internal/version.ts
|
|
12
|
+
var SDK_VERSION = "0.13.1";
|
|
13
|
+
|
|
11
14
|
// src/internal/exceptions.ts
|
|
12
15
|
var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
|
|
13
16
|
constructor(message) {
|
|
@@ -156,7 +159,7 @@ var BaseClient = class {
|
|
|
156
159
|
"Content-Type": "application/json",
|
|
157
160
|
Accept: "application/json",
|
|
158
161
|
"X-API-Key": this.config.apiKey,
|
|
159
|
-
"User-Agent":
|
|
162
|
+
"User-Agent": `scrapebadger-node/${SDK_VERSION}`,
|
|
160
163
|
...headers
|
|
161
164
|
};
|
|
162
165
|
const fetchOptions = {
|
|
@@ -4189,6 +4192,612 @@ var AmazonClient = class {
|
|
|
4189
4192
|
}
|
|
4190
4193
|
};
|
|
4191
4194
|
|
|
4195
|
+
// src/shopee/search.ts
|
|
4196
|
+
var SearchClient5 = class {
|
|
4197
|
+
client;
|
|
4198
|
+
constructor(client) {
|
|
4199
|
+
this.client = client;
|
|
4200
|
+
}
|
|
4201
|
+
/**
|
|
4202
|
+
* Search Shopee for products by keyword.
|
|
4203
|
+
*
|
|
4204
|
+
* @param params - Search parameters including keyword, market, pagination, and sort.
|
|
4205
|
+
* @returns Search result page with matched products and pagination metadata.
|
|
4206
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
4207
|
+
* @throws ValidationError - If the parameters are invalid.
|
|
4208
|
+
*/
|
|
4209
|
+
async search(params) {
|
|
4210
|
+
return this.client.request("/v1/shopee/search", {
|
|
4211
|
+
params: {
|
|
4212
|
+
keyword: params.keyword,
|
|
4213
|
+
market: params.market,
|
|
4214
|
+
limit: params.limit,
|
|
4215
|
+
offset: params.offset,
|
|
4216
|
+
sort_by: params.sort_by
|
|
4217
|
+
}
|
|
4218
|
+
});
|
|
4219
|
+
}
|
|
4220
|
+
/**
|
|
4221
|
+
* List products within a specific Shopee category.
|
|
4222
|
+
*
|
|
4223
|
+
* @param categoryId - The Shopee category ID.
|
|
4224
|
+
* @param options - Optional parameters (market, limit, offset, sort_by).
|
|
4225
|
+
* @returns Search result page with products in the category.
|
|
4226
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
4227
|
+
* @throws ValidationError - If the category ID or market is invalid.
|
|
4228
|
+
*/
|
|
4229
|
+
async categoryItems(categoryId, options = {}) {
|
|
4230
|
+
return this.client.request(
|
|
4231
|
+
`/v1/shopee/category/${categoryId}/items`,
|
|
4232
|
+
{
|
|
4233
|
+
params: {
|
|
4234
|
+
market: options.market,
|
|
4235
|
+
limit: options.limit,
|
|
4236
|
+
offset: options.offset,
|
|
4237
|
+
sort_by: options.sort_by
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
);
|
|
4241
|
+
}
|
|
4242
|
+
};
|
|
4243
|
+
|
|
4244
|
+
// src/shopee/products.ts
|
|
4245
|
+
var ProductsClient3 = class {
|
|
4246
|
+
client;
|
|
4247
|
+
constructor(client) {
|
|
4248
|
+
this.client = client;
|
|
4249
|
+
}
|
|
4250
|
+
/**
|
|
4251
|
+
* Get full product detail (PDP) for a Shopee item.
|
|
4252
|
+
*
|
|
4253
|
+
* @param shopId - The Shopee shop identifier.
|
|
4254
|
+
* @param itemId - The Shopee item identifier.
|
|
4255
|
+
* @param options - Optional parameters (market).
|
|
4256
|
+
* @returns Full product detail including pricing, ratings, images, and variations.
|
|
4257
|
+
* @throws NotFoundError - If the product doesn't exist.
|
|
4258
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
4259
|
+
* @throws ValidationError - If the market code is invalid.
|
|
4260
|
+
*/
|
|
4261
|
+
async get(shopId, itemId, options = {}) {
|
|
4262
|
+
return this.client.request(
|
|
4263
|
+
`/v1/shopee/product/${shopId}/${itemId}`,
|
|
4264
|
+
{ params: { market: options.market } }
|
|
4265
|
+
);
|
|
4266
|
+
}
|
|
4267
|
+
};
|
|
4268
|
+
|
|
4269
|
+
// src/shopee/reviews.ts
|
|
4270
|
+
var ReviewsClient = class {
|
|
4271
|
+
client;
|
|
4272
|
+
constructor(client) {
|
|
4273
|
+
this.client = client;
|
|
4274
|
+
}
|
|
4275
|
+
/**
|
|
4276
|
+
* Get product reviews for a Shopee item.
|
|
4277
|
+
*
|
|
4278
|
+
* @param shopId - The Shopee shop identifier.
|
|
4279
|
+
* @param itemId - The Shopee item identifier.
|
|
4280
|
+
* @param options - Optional parameters (market, limit, offset, rating, filter).
|
|
4281
|
+
* @returns Reviews result page with review items and aggregate summary.
|
|
4282
|
+
* @throws NotFoundError - If the product doesn't exist.
|
|
4283
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
4284
|
+
* @throws ValidationError - If the parameters are invalid.
|
|
4285
|
+
*/
|
|
4286
|
+
async get(shopId, itemId, options = {}) {
|
|
4287
|
+
return this.client.request(
|
|
4288
|
+
`/v1/shopee/product/${shopId}/${itemId}/reviews`,
|
|
4289
|
+
{
|
|
4290
|
+
params: {
|
|
4291
|
+
market: options.market,
|
|
4292
|
+
limit: options.limit,
|
|
4293
|
+
offset: options.offset,
|
|
4294
|
+
rating: options.rating,
|
|
4295
|
+
filter: options.filter
|
|
4296
|
+
}
|
|
4297
|
+
}
|
|
4298
|
+
);
|
|
4299
|
+
}
|
|
4300
|
+
};
|
|
4301
|
+
|
|
4302
|
+
// src/shopee/reference.ts
|
|
4303
|
+
var ReferenceClient3 = class {
|
|
4304
|
+
client;
|
|
4305
|
+
constructor(client) {
|
|
4306
|
+
this.client = client;
|
|
4307
|
+
}
|
|
4308
|
+
/**
|
|
4309
|
+
* Get all supported Shopee marketplaces.
|
|
4310
|
+
*
|
|
4311
|
+
* @returns Markets response with all supported Shopee markets (0 credits).
|
|
4312
|
+
*/
|
|
4313
|
+
async markets() {
|
|
4314
|
+
return this.client.request("/v1/shopee/markets");
|
|
4315
|
+
}
|
|
4316
|
+
/**
|
|
4317
|
+
* Get the full category tree for a Shopee market.
|
|
4318
|
+
*
|
|
4319
|
+
* @param options - Optional parameters (market).
|
|
4320
|
+
* @returns Category tree with all top-level and nested category nodes.
|
|
4321
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
4322
|
+
* @throws ValidationError - If the market code is invalid.
|
|
4323
|
+
*/
|
|
4324
|
+
async categories(options = {}) {
|
|
4325
|
+
return this.client.request("/v1/shopee/categories", {
|
|
4326
|
+
params: { market: options.market }
|
|
4327
|
+
});
|
|
4328
|
+
}
|
|
4329
|
+
};
|
|
4330
|
+
|
|
4331
|
+
// src/shopee/client.ts
|
|
4332
|
+
var ShopeeClient = class {
|
|
4333
|
+
/** Client for keyword search and category-item listing */
|
|
4334
|
+
search;
|
|
4335
|
+
/** Client for full product detail pages */
|
|
4336
|
+
products;
|
|
4337
|
+
/** Client for product reviews and rating summaries */
|
|
4338
|
+
reviews;
|
|
4339
|
+
/** Client for reference data (markets, category tree) */
|
|
4340
|
+
reference;
|
|
4341
|
+
/**
|
|
4342
|
+
* Create a new Shopee client.
|
|
4343
|
+
*
|
|
4344
|
+
* @param client - The base HTTP client for making requests.
|
|
4345
|
+
*/
|
|
4346
|
+
constructor(client) {
|
|
4347
|
+
this.search = new SearchClient5(client);
|
|
4348
|
+
this.products = new ProductsClient3(client);
|
|
4349
|
+
this.reviews = new ReviewsClient(client);
|
|
4350
|
+
this.reference = new ReferenceClient3(client);
|
|
4351
|
+
}
|
|
4352
|
+
};
|
|
4353
|
+
|
|
4354
|
+
// src/tiktok/users.ts
|
|
4355
|
+
var UsersClient4 = class {
|
|
4356
|
+
client;
|
|
4357
|
+
constructor(client) {
|
|
4358
|
+
this.client = client;
|
|
4359
|
+
}
|
|
4360
|
+
/**
|
|
4361
|
+
* Get a TikTok user's full profile.
|
|
4362
|
+
*
|
|
4363
|
+
* @param username - The user's @handle (without the leading '@').
|
|
4364
|
+
* @param options - Optional parameters (region).
|
|
4365
|
+
* @returns The user profile response.
|
|
4366
|
+
* @throws NotFoundError - If the user doesn't exist.
|
|
4367
|
+
*/
|
|
4368
|
+
async get(username, options = {}) {
|
|
4369
|
+
return this.client.request(`/v1/tiktok/users/${username}`, {
|
|
4370
|
+
params: { region: options.region }
|
|
4371
|
+
});
|
|
4372
|
+
}
|
|
4373
|
+
/**
|
|
4374
|
+
* Get a TikTok user's posted videos.
|
|
4375
|
+
*
|
|
4376
|
+
* @param username - The user's @handle.
|
|
4377
|
+
* @param options - Optional parameters (region, count, cursor).
|
|
4378
|
+
* @returns A cursor-paginated list of videos.
|
|
4379
|
+
*/
|
|
4380
|
+
async videos(username, options = {}) {
|
|
4381
|
+
return this.client.request(`/v1/tiktok/users/${username}/videos`, {
|
|
4382
|
+
params: { region: options.region, count: options.count, cursor: options.cursor }
|
|
4383
|
+
});
|
|
4384
|
+
}
|
|
4385
|
+
/**
|
|
4386
|
+
* Get a TikTok user's followers (best-effort; often guest-gated).
|
|
4387
|
+
*
|
|
4388
|
+
* @deprecated Requires an authenticated session; currently returns 410.
|
|
4389
|
+
* Kept for forward-compatibility — the endpoint may be re-enabled when
|
|
4390
|
+
* session-based access is supported.
|
|
4391
|
+
*
|
|
4392
|
+
* @param username - The user's @handle.
|
|
4393
|
+
* @param options - Optional parameters (region, count, cursor).
|
|
4394
|
+
* @returns A cursor-paginated list of follower authors.
|
|
4395
|
+
*/
|
|
4396
|
+
async followers(username, options = {}) {
|
|
4397
|
+
return this.client.request(`/v1/tiktok/users/${username}/followers`, {
|
|
4398
|
+
params: { region: options.region, count: options.count, cursor: options.cursor }
|
|
4399
|
+
});
|
|
4400
|
+
}
|
|
4401
|
+
/**
|
|
4402
|
+
* Get accounts a TikTok user follows (best-effort).
|
|
4403
|
+
*
|
|
4404
|
+
* @deprecated Requires an authenticated session; currently returns 410.
|
|
4405
|
+
* Kept for forward-compatibility — the endpoint may be re-enabled when
|
|
4406
|
+
* session-based access is supported.
|
|
4407
|
+
*
|
|
4408
|
+
* @param username - The user's @handle.
|
|
4409
|
+
* @param options - Optional parameters (region, count, cursor).
|
|
4410
|
+
* @returns A cursor-paginated list of followed authors.
|
|
4411
|
+
*/
|
|
4412
|
+
async following(username, options = {}) {
|
|
4413
|
+
return this.client.request(`/v1/tiktok/users/${username}/following`, {
|
|
4414
|
+
params: { region: options.region, count: options.count, cursor: options.cursor }
|
|
4415
|
+
});
|
|
4416
|
+
}
|
|
4417
|
+
/**
|
|
4418
|
+
* Get a TikTok user's liked videos (only if their Liked tab is public).
|
|
4419
|
+
*
|
|
4420
|
+
* @deprecated Requires an authenticated session; currently returns 410.
|
|
4421
|
+
* Kept for forward-compatibility — the endpoint may be re-enabled when
|
|
4422
|
+
* session-based access is supported.
|
|
4423
|
+
*
|
|
4424
|
+
* @param username - The user's @handle.
|
|
4425
|
+
* @param options - Optional parameters (region, count).
|
|
4426
|
+
* @returns A cursor-paginated list of videos.
|
|
4427
|
+
*/
|
|
4428
|
+
async liked(username, options = {}) {
|
|
4429
|
+
return this.client.request(`/v1/tiktok/users/${username}/liked`, {
|
|
4430
|
+
params: { region: options.region, count: options.count }
|
|
4431
|
+
});
|
|
4432
|
+
}
|
|
4433
|
+
/**
|
|
4434
|
+
* Get videos a TikTok user has reposted.
|
|
4435
|
+
*
|
|
4436
|
+
* @param username - The user's @handle.
|
|
4437
|
+
* @param options - Optional parameters (region, count).
|
|
4438
|
+
* @returns A cursor-paginated list of videos.
|
|
4439
|
+
*/
|
|
4440
|
+
async reposts(username, options = {}) {
|
|
4441
|
+
return this.client.request(`/v1/tiktok/users/${username}/reposts`, {
|
|
4442
|
+
params: { region: options.region, count: options.count }
|
|
4443
|
+
});
|
|
4444
|
+
}
|
|
4445
|
+
};
|
|
4446
|
+
|
|
4447
|
+
// src/tiktok/videos.ts
|
|
4448
|
+
var VideosClient2 = class {
|
|
4449
|
+
client;
|
|
4450
|
+
constructor(client) {
|
|
4451
|
+
this.client = client;
|
|
4452
|
+
}
|
|
4453
|
+
/**
|
|
4454
|
+
* Get full metadata for a single TikTok video/post.
|
|
4455
|
+
*
|
|
4456
|
+
* @param videoId - The video/post id.
|
|
4457
|
+
* @param options - Optional parameters (region, username).
|
|
4458
|
+
* @returns The video detail response.
|
|
4459
|
+
* @throws NotFoundError - If the video doesn't exist.
|
|
4460
|
+
*/
|
|
4461
|
+
async get(videoId, options = {}) {
|
|
4462
|
+
return this.client.request(`/v1/tiktok/videos/${videoId}`, {
|
|
4463
|
+
params: { region: options.region, username: options.username }
|
|
4464
|
+
});
|
|
4465
|
+
}
|
|
4466
|
+
/**
|
|
4467
|
+
* Get top-level comments on a TikTok video.
|
|
4468
|
+
*
|
|
4469
|
+
* @param videoId - The video/post id.
|
|
4470
|
+
* @param options - Optional parameters (region, count, cursor).
|
|
4471
|
+
* @returns A cursor-paginated list of comments.
|
|
4472
|
+
*/
|
|
4473
|
+
async comments(videoId, options = {}) {
|
|
4474
|
+
return this.client.request(`/v1/tiktok/videos/${videoId}/comments`, {
|
|
4475
|
+
params: { region: options.region, count: options.count, cursor: options.cursor }
|
|
4476
|
+
});
|
|
4477
|
+
}
|
|
4478
|
+
/**
|
|
4479
|
+
* Get replies to a TikTok comment (best-effort).
|
|
4480
|
+
*
|
|
4481
|
+
* @param commentId - The comment id.
|
|
4482
|
+
* @param options - Parameters including the required `videoId` (region, count, cursor).
|
|
4483
|
+
* @returns A cursor-paginated list of reply comments.
|
|
4484
|
+
*/
|
|
4485
|
+
async commentReplies(commentId, options) {
|
|
4486
|
+
return this.client.request(`/v1/tiktok/comments/${commentId}/replies`, {
|
|
4487
|
+
params: {
|
|
4488
|
+
video_id: options.videoId,
|
|
4489
|
+
region: options.region,
|
|
4490
|
+
count: options.count,
|
|
4491
|
+
cursor: options.cursor
|
|
4492
|
+
}
|
|
4493
|
+
});
|
|
4494
|
+
}
|
|
4495
|
+
/**
|
|
4496
|
+
* Get TikTok's related videos for a given video.
|
|
4497
|
+
*
|
|
4498
|
+
* @param videoId - The video/post id.
|
|
4499
|
+
* @param options - Optional parameters (region, count).
|
|
4500
|
+
* @returns A cursor-paginated list of related videos.
|
|
4501
|
+
*/
|
|
4502
|
+
async related(videoId, options = {}) {
|
|
4503
|
+
return this.client.request(`/v1/tiktok/videos/${videoId}/related`, {
|
|
4504
|
+
params: { region: options.region, count: options.count }
|
|
4505
|
+
});
|
|
4506
|
+
}
|
|
4507
|
+
/**
|
|
4508
|
+
* Get subtitle/caption tracks for a TikTok video.
|
|
4509
|
+
*
|
|
4510
|
+
* @param videoId - The video/post id.
|
|
4511
|
+
* @param options - Optional parameters (region).
|
|
4512
|
+
* @returns The transcript response with subtitle tracks and voice-to-text.
|
|
4513
|
+
*/
|
|
4514
|
+
async transcript(videoId, options = {}) {
|
|
4515
|
+
return this.client.request(`/v1/tiktok/videos/${videoId}/transcript`, {
|
|
4516
|
+
params: { region: options.region }
|
|
4517
|
+
});
|
|
4518
|
+
}
|
|
4519
|
+
/**
|
|
4520
|
+
* Get cheap unauthenticated oEmbed metadata for a TikTok URL.
|
|
4521
|
+
*
|
|
4522
|
+
* @param url - Full TikTok video or profile URL.
|
|
4523
|
+
* @param options - Optional parameters (region).
|
|
4524
|
+
* @returns The oEmbed metadata.
|
|
4525
|
+
*/
|
|
4526
|
+
async oembed(url, options = {}) {
|
|
4527
|
+
return this.client.request("/v1/tiktok/oembed", {
|
|
4528
|
+
params: { url, region: options.region }
|
|
4529
|
+
});
|
|
4530
|
+
}
|
|
4531
|
+
};
|
|
4532
|
+
|
|
4533
|
+
// src/tiktok/search.ts
|
|
4534
|
+
var SearchClient6 = class {
|
|
4535
|
+
client;
|
|
4536
|
+
constructor(client) {
|
|
4537
|
+
this.client = client;
|
|
4538
|
+
}
|
|
4539
|
+
/**
|
|
4540
|
+
* General TikTok search — video results from the Top feed.
|
|
4541
|
+
*
|
|
4542
|
+
* @param params - Search parameters including query, region, count, cursor.
|
|
4543
|
+
* @returns A cursor-paginated list of videos.
|
|
4544
|
+
*/
|
|
4545
|
+
async search(params) {
|
|
4546
|
+
return this.client.request("/v1/tiktok/search", {
|
|
4547
|
+
params: {
|
|
4548
|
+
query: params.query,
|
|
4549
|
+
region: params.region,
|
|
4550
|
+
count: params.count,
|
|
4551
|
+
cursor: params.cursor
|
|
4552
|
+
}
|
|
4553
|
+
});
|
|
4554
|
+
}
|
|
4555
|
+
/**
|
|
4556
|
+
* Search TikTok videos by keyword.
|
|
4557
|
+
*
|
|
4558
|
+
* @param params - Search parameters including query, region, count, cursor.
|
|
4559
|
+
* @returns A cursor-paginated list of videos.
|
|
4560
|
+
*/
|
|
4561
|
+
async videos(params) {
|
|
4562
|
+
return this.client.request("/v1/tiktok/search/videos", {
|
|
4563
|
+
params: {
|
|
4564
|
+
query: params.query,
|
|
4565
|
+
region: params.region,
|
|
4566
|
+
count: params.count,
|
|
4567
|
+
cursor: params.cursor
|
|
4568
|
+
}
|
|
4569
|
+
});
|
|
4570
|
+
}
|
|
4571
|
+
/**
|
|
4572
|
+
* Search TikTok users by keyword.
|
|
4573
|
+
*
|
|
4574
|
+
* @param params - Search parameters including query, region, count, cursor.
|
|
4575
|
+
* @returns A cursor-paginated list of matching users.
|
|
4576
|
+
*/
|
|
4577
|
+
async users(params) {
|
|
4578
|
+
return this.client.request("/v1/tiktok/search/users", {
|
|
4579
|
+
params: {
|
|
4580
|
+
query: params.query,
|
|
4581
|
+
region: params.region,
|
|
4582
|
+
count: params.count,
|
|
4583
|
+
cursor: params.cursor
|
|
4584
|
+
}
|
|
4585
|
+
});
|
|
4586
|
+
}
|
|
4587
|
+
/**
|
|
4588
|
+
* Search TikTok hashtags by keyword.
|
|
4589
|
+
*
|
|
4590
|
+
* @param params - Search parameters including query, region, count, cursor.
|
|
4591
|
+
* @returns A cursor-paginated list of matching hashtags.
|
|
4592
|
+
*/
|
|
4593
|
+
async hashtags(params) {
|
|
4594
|
+
return this.client.request("/v1/tiktok/search/hashtags", {
|
|
4595
|
+
params: {
|
|
4596
|
+
query: params.query,
|
|
4597
|
+
region: params.region,
|
|
4598
|
+
count: params.count,
|
|
4599
|
+
cursor: params.cursor
|
|
4600
|
+
}
|
|
4601
|
+
});
|
|
4602
|
+
}
|
|
4603
|
+
};
|
|
4604
|
+
|
|
4605
|
+
// src/tiktok/music.ts
|
|
4606
|
+
var MusicClient = class {
|
|
4607
|
+
client;
|
|
4608
|
+
constructor(client) {
|
|
4609
|
+
this.client = client;
|
|
4610
|
+
}
|
|
4611
|
+
/**
|
|
4612
|
+
* Get TikTok sound/music detail.
|
|
4613
|
+
*
|
|
4614
|
+
* @param musicId - The sound/music id.
|
|
4615
|
+
* @param options - Optional parameters (region).
|
|
4616
|
+
* @returns The music detail response.
|
|
4617
|
+
* @throws NotFoundError - If the music doesn't exist.
|
|
4618
|
+
*/
|
|
4619
|
+
async get(musicId, options = {}) {
|
|
4620
|
+
return this.client.request(`/v1/tiktok/music/${musicId}`, {
|
|
4621
|
+
params: { region: options.region }
|
|
4622
|
+
});
|
|
4623
|
+
}
|
|
4624
|
+
/**
|
|
4625
|
+
* Get videos using a given TikTok sound.
|
|
4626
|
+
*
|
|
4627
|
+
* @param musicId - The sound/music id.
|
|
4628
|
+
* @param options - Optional parameters (region, count, cursor).
|
|
4629
|
+
* @returns A cursor-paginated list of videos.
|
|
4630
|
+
*/
|
|
4631
|
+
async videos(musicId, options = {}) {
|
|
4632
|
+
return this.client.request(`/v1/tiktok/music/${musicId}/videos`, {
|
|
4633
|
+
params: { region: options.region, count: options.count, cursor: options.cursor }
|
|
4634
|
+
});
|
|
4635
|
+
}
|
|
4636
|
+
};
|
|
4637
|
+
|
|
4638
|
+
// src/tiktok/hashtags.ts
|
|
4639
|
+
var HashtagsClient = class {
|
|
4640
|
+
client;
|
|
4641
|
+
constructor(client) {
|
|
4642
|
+
this.client = client;
|
|
4643
|
+
}
|
|
4644
|
+
/**
|
|
4645
|
+
* Get TikTok hashtag/challenge detail.
|
|
4646
|
+
*
|
|
4647
|
+
* @param name - The hashtag name (without the leading '#').
|
|
4648
|
+
* @param options - Optional parameters (region).
|
|
4649
|
+
* @returns The hashtag detail response.
|
|
4650
|
+
* @throws NotFoundError - If the hashtag doesn't exist.
|
|
4651
|
+
*/
|
|
4652
|
+
async get(name, options = {}) {
|
|
4653
|
+
return this.client.request(`/v1/tiktok/hashtags/${name}`, {
|
|
4654
|
+
params: { region: options.region }
|
|
4655
|
+
});
|
|
4656
|
+
}
|
|
4657
|
+
/**
|
|
4658
|
+
* Get videos tagged with a TikTok hashtag.
|
|
4659
|
+
*
|
|
4660
|
+
* @param name - The hashtag name (without the leading '#').
|
|
4661
|
+
* @param options - Optional parameters (region, count, cursor).
|
|
4662
|
+
* @returns A cursor-paginated list of videos.
|
|
4663
|
+
*/
|
|
4664
|
+
async videos(name, options = {}) {
|
|
4665
|
+
return this.client.request(`/v1/tiktok/hashtags/${name}/videos`, {
|
|
4666
|
+
params: { region: options.region, count: options.count, cursor: options.cursor }
|
|
4667
|
+
});
|
|
4668
|
+
}
|
|
4669
|
+
};
|
|
4670
|
+
|
|
4671
|
+
// src/tiktok/trending.ts
|
|
4672
|
+
var TrendingClient = class {
|
|
4673
|
+
client;
|
|
4674
|
+
constructor(client) {
|
|
4675
|
+
this.client = client;
|
|
4676
|
+
}
|
|
4677
|
+
/**
|
|
4678
|
+
* Get trending videos from the TikTok Explore feed.
|
|
4679
|
+
*
|
|
4680
|
+
* @param options - Optional parameters (region, count).
|
|
4681
|
+
* @returns A cursor-paginated list of trending videos.
|
|
4682
|
+
*/
|
|
4683
|
+
async videos(options = {}) {
|
|
4684
|
+
return this.client.request("/v1/tiktok/trending/videos", {
|
|
4685
|
+
params: { region: options.region, count: options.count }
|
|
4686
|
+
});
|
|
4687
|
+
}
|
|
4688
|
+
/**
|
|
4689
|
+
* Get trending hashtags (mobile Discover surface — view_count + creators).
|
|
4690
|
+
*
|
|
4691
|
+
* @param options - Optional parameters (region, period, count).
|
|
4692
|
+
* @returns The trending hashtags response.
|
|
4693
|
+
*/
|
|
4694
|
+
async hashtags(options = {}) {
|
|
4695
|
+
return this.client.request(
|
|
4696
|
+
"/v1/tiktok/trending/hashtags",
|
|
4697
|
+
{ params: { region: options.region, period: options.period, count: options.count } }
|
|
4698
|
+
);
|
|
4699
|
+
}
|
|
4700
|
+
/**
|
|
4701
|
+
* Get trending songs/sounds (mobile hot-music feed — ranked by usage).
|
|
4702
|
+
*
|
|
4703
|
+
* @param options - Optional parameters (region, period, count).
|
|
4704
|
+
* @returns The trending songs response.
|
|
4705
|
+
*/
|
|
4706
|
+
async songs(options = {}) {
|
|
4707
|
+
return this.client.request(
|
|
4708
|
+
"/v1/tiktok/trending/songs",
|
|
4709
|
+
{ params: { region: options.region, period: options.period, count: options.count } }
|
|
4710
|
+
);
|
|
4711
|
+
}
|
|
4712
|
+
};
|
|
4713
|
+
|
|
4714
|
+
// src/tiktok/ads.ts
|
|
4715
|
+
var AdsClient = class {
|
|
4716
|
+
client;
|
|
4717
|
+
constructor(client) {
|
|
4718
|
+
this.client = client;
|
|
4719
|
+
}
|
|
4720
|
+
/**
|
|
4721
|
+
* Search TikTok's Commercial Content Library (ad transparency) by keyword or advertiser.
|
|
4722
|
+
*
|
|
4723
|
+
* @param params - Optional parameters (query, advertiser_id, region, days, sort, offset, search_id, count).
|
|
4724
|
+
* @returns The ad-library search response with ads and pagination.
|
|
4725
|
+
*/
|
|
4726
|
+
async search(params = {}) {
|
|
4727
|
+
return this.client.request("/v1/tiktok/ads/search", {
|
|
4728
|
+
params: {
|
|
4729
|
+
query: params.query,
|
|
4730
|
+
advertiser_id: params.advertiser_id,
|
|
4731
|
+
region: params.region,
|
|
4732
|
+
days: params.days,
|
|
4733
|
+
sort: params.sort,
|
|
4734
|
+
offset: params.offset,
|
|
4735
|
+
search_id: params.search_id,
|
|
4736
|
+
count: params.count
|
|
4737
|
+
}
|
|
4738
|
+
});
|
|
4739
|
+
}
|
|
4740
|
+
};
|
|
4741
|
+
|
|
4742
|
+
// src/tiktok/reference.ts
|
|
4743
|
+
var ReferenceClient4 = class {
|
|
4744
|
+
client;
|
|
4745
|
+
constructor(client) {
|
|
4746
|
+
this.client = client;
|
|
4747
|
+
}
|
|
4748
|
+
/**
|
|
4749
|
+
* List supported TikTok content regions.
|
|
4750
|
+
*
|
|
4751
|
+
* @returns The regions response with all supported content regions.
|
|
4752
|
+
*/
|
|
4753
|
+
async regions() {
|
|
4754
|
+
return this.client.request("/v1/tiktok/regions");
|
|
4755
|
+
}
|
|
4756
|
+
/**
|
|
4757
|
+
* Check the health of the TikTok scraper service.
|
|
4758
|
+
*
|
|
4759
|
+
* @returns The raw health payload from the scraper service.
|
|
4760
|
+
*/
|
|
4761
|
+
async health() {
|
|
4762
|
+
return this.client.request("/v1/tiktok/health");
|
|
4763
|
+
}
|
|
4764
|
+
};
|
|
4765
|
+
|
|
4766
|
+
// src/tiktok/client.ts
|
|
4767
|
+
var TikTokClient = class {
|
|
4768
|
+
/** Client for profiles, videos, followers, following, liked, reposts */
|
|
4769
|
+
users;
|
|
4770
|
+
/** Client for video detail, comments, replies, related, transcript, oEmbed */
|
|
4771
|
+
videos;
|
|
4772
|
+
/** Client for keyword search across videos, users, and hashtags */
|
|
4773
|
+
search;
|
|
4774
|
+
/** Client for sound/music detail and videos using a sound */
|
|
4775
|
+
music;
|
|
4776
|
+
/** Client for hashtag detail and tagged videos */
|
|
4777
|
+
hashtags;
|
|
4778
|
+
/** Client for trending videos, hashtags, and songs */
|
|
4779
|
+
trending;
|
|
4780
|
+
/** Client for the Commercial Content Library (ad transparency) */
|
|
4781
|
+
ads;
|
|
4782
|
+
/** Client for reference data (regions) and service health */
|
|
4783
|
+
reference;
|
|
4784
|
+
/**
|
|
4785
|
+
* Create a new TikTok client.
|
|
4786
|
+
*
|
|
4787
|
+
* @param client - The base HTTP client for making requests.
|
|
4788
|
+
*/
|
|
4789
|
+
constructor(client) {
|
|
4790
|
+
this.users = new UsersClient4(client);
|
|
4791
|
+
this.videos = new VideosClient2(client);
|
|
4792
|
+
this.search = new SearchClient6(client);
|
|
4793
|
+
this.music = new MusicClient(client);
|
|
4794
|
+
this.hashtags = new HashtagsClient(client);
|
|
4795
|
+
this.trending = new TrendingClient(client);
|
|
4796
|
+
this.ads = new AdsClient(client);
|
|
4797
|
+
this.reference = new ReferenceClient4(client);
|
|
4798
|
+
}
|
|
4799
|
+
};
|
|
4800
|
+
|
|
4192
4801
|
// src/client.ts
|
|
4193
4802
|
var ScrapeBadger = class {
|
|
4194
4803
|
baseClient;
|
|
@@ -4204,6 +4813,10 @@ var ScrapeBadger = class {
|
|
|
4204
4813
|
reddit;
|
|
4205
4814
|
/** Amazon scraper API client — 14 endpoints */
|
|
4206
4815
|
amazon;
|
|
4816
|
+
/** Shopee scraper API client — 6 endpoints across 11 markets */
|
|
4817
|
+
shopee;
|
|
4818
|
+
/** TikTok scraper API client — 26 endpoints */
|
|
4819
|
+
tiktok;
|
|
4207
4820
|
/**
|
|
4208
4821
|
* Create a new ScrapeBadger client.
|
|
4209
4822
|
*
|
|
@@ -4244,6 +4857,8 @@ var ScrapeBadger = class {
|
|
|
4244
4857
|
this.google = new GoogleClient(this.baseClient);
|
|
4245
4858
|
this.reddit = new RedditClient(this.baseClient);
|
|
4246
4859
|
this.amazon = new AmazonClient(this.baseClient);
|
|
4860
|
+
this.shopee = new ShopeeClient(this.baseClient);
|
|
4861
|
+
this.tiktok = new TikTokClient(this.baseClient);
|
|
4247
4862
|
}
|
|
4248
4863
|
};
|
|
4249
4864
|
|
|
@@ -4289,8 +4904,22 @@ exports.RedditUsersClient = UsersClient3;
|
|
|
4289
4904
|
exports.ScrapeBadger = ScrapeBadger;
|
|
4290
4905
|
exports.ScrapeBadgerError = ScrapeBadgerError;
|
|
4291
4906
|
exports.ServerError = ServerError;
|
|
4907
|
+
exports.ShopeeClient = ShopeeClient;
|
|
4908
|
+
exports.ShopeeProductsClient = ProductsClient3;
|
|
4909
|
+
exports.ShopeeReferenceClient = ReferenceClient3;
|
|
4910
|
+
exports.ShopeeReviewsClient = ReviewsClient;
|
|
4911
|
+
exports.ShopeeSearchClient = SearchClient5;
|
|
4292
4912
|
exports.SpacesClient = SpacesClient;
|
|
4293
4913
|
exports.StreamClient = StreamClient;
|
|
4914
|
+
exports.TikTokAdsClient = AdsClient;
|
|
4915
|
+
exports.TikTokClient = TikTokClient;
|
|
4916
|
+
exports.TikTokHashtagsClient = HashtagsClient;
|
|
4917
|
+
exports.TikTokMusicClient = MusicClient;
|
|
4918
|
+
exports.TikTokReferenceClient = ReferenceClient4;
|
|
4919
|
+
exports.TikTokSearchClient = SearchClient6;
|
|
4920
|
+
exports.TikTokTrendingClient = TrendingClient;
|
|
4921
|
+
exports.TikTokUsersClient = UsersClient4;
|
|
4922
|
+
exports.TikTokVideosClient = VideosClient2;
|
|
4294
4923
|
exports.TimeoutError = TimeoutError;
|
|
4295
4924
|
exports.TrendsClient = TrendsClient;
|
|
4296
4925
|
exports.TweetsClient = TweetsClient;
|