scrapebadger 0.3.1 → 0.7.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 +27 -291
- package/dist/{index-Cg0sNluO.d.cts → index-CIZUd1Zr.d.cts} +319 -1
- package/dist/{index-Cg0sNluO.d.ts → index-CIZUd1Zr.d.ts} +319 -1
- package/dist/index.d.cts +1906 -104
- package/dist/index.d.ts +1906 -104
- package/dist/index.js +1044 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1020 -58
- package/dist/index.mjs.map +1 -1
- package/dist/twitter/index.d.cts +1 -1
- package/dist/twitter/index.d.ts +1 -1
- package/dist/twitter/index.js +207 -1
- package/dist/twitter/index.js.map +1 -1
- package/dist/twitter/index.mjs +207 -2
- package/dist/twitter/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -704,6 +704,59 @@ var TweetsClient = class {
|
|
|
704
704
|
};
|
|
705
705
|
yield* paginate(fetchPage, options);
|
|
706
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* Get the edit history of a tweet.
|
|
709
|
+
*
|
|
710
|
+
* @param tweetId - The tweet ID to get edit history for.
|
|
711
|
+
* @returns Paginated response containing tweet versions.
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* ```typescript
|
|
715
|
+
* const history = await client.twitter.tweets.getEditHistory("1234567890");
|
|
716
|
+
* console.log(`${history.data.length} version(s) of this tweet`);
|
|
717
|
+
* ```
|
|
718
|
+
*/
|
|
719
|
+
async getEditHistory(tweetId) {
|
|
720
|
+
const response = await this.client.request(
|
|
721
|
+
`/v1/twitter/tweets/tweet/${tweetId}/edit_history`
|
|
722
|
+
);
|
|
723
|
+
return createPaginatedResponse(response.data ?? [], void 0);
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Get community notes (Birdwatch) attached to a tweet.
|
|
727
|
+
*
|
|
728
|
+
* @param tweetId - The tweet ID to get community notes for.
|
|
729
|
+
* @returns Paginated response containing community notes.
|
|
730
|
+
*
|
|
731
|
+
* @example
|
|
732
|
+
* ```typescript
|
|
733
|
+
* const notes = await client.twitter.tweets.getCommunityNotes("1234567890");
|
|
734
|
+
* for (const note of notes.data) {
|
|
735
|
+
* console.log(note.text);
|
|
736
|
+
* }
|
|
737
|
+
* ```
|
|
738
|
+
*/
|
|
739
|
+
async getCommunityNotes(tweetId) {
|
|
740
|
+
const response = await this.client.request(
|
|
741
|
+
`/v1/twitter/tweets/tweet/${tweetId}/community_notes`
|
|
742
|
+
);
|
|
743
|
+
return createPaginatedResponse(response.data ?? [], void 0);
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Get a long-form article by its ID.
|
|
747
|
+
*
|
|
748
|
+
* @param articleId - The article ID to fetch.
|
|
749
|
+
* @returns The article data.
|
|
750
|
+
*
|
|
751
|
+
* @example
|
|
752
|
+
* ```typescript
|
|
753
|
+
* const article = await client.twitter.tweets.getArticle("abc123");
|
|
754
|
+
* console.log(`${article.title}: ${article.text?.slice(0, 100)}...`);
|
|
755
|
+
* ```
|
|
756
|
+
*/
|
|
757
|
+
async getArticle(articleId) {
|
|
758
|
+
return this.client.request(`/v1/twitter/tweets/article/${articleId}`);
|
|
759
|
+
}
|
|
707
760
|
};
|
|
708
761
|
|
|
709
762
|
// src/twitter/users.ts
|
|
@@ -1015,6 +1068,92 @@ var UsersClient = class {
|
|
|
1015
1068
|
};
|
|
1016
1069
|
yield* paginate(fetchPage, options);
|
|
1017
1070
|
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Get multiple users by their numeric IDs in a single request.
|
|
1073
|
+
*
|
|
1074
|
+
* @param userIds - List of user IDs to fetch.
|
|
1075
|
+
* @returns Paginated response containing the matching users.
|
|
1076
|
+
*
|
|
1077
|
+
* @example
|
|
1078
|
+
* ```typescript
|
|
1079
|
+
* const users = await client.twitter.users.getByIds(["44196397", "783214"]);
|
|
1080
|
+
* for (const user of users.data) {
|
|
1081
|
+
* console.log(`@${user.username}`);
|
|
1082
|
+
* }
|
|
1083
|
+
* ```
|
|
1084
|
+
*/
|
|
1085
|
+
async getByIds(userIds) {
|
|
1086
|
+
const response = await this.client.request(
|
|
1087
|
+
"/v1/twitter/users/batch_by_ids",
|
|
1088
|
+
{ params: { user_ids: userIds.join(",") } }
|
|
1089
|
+
);
|
|
1090
|
+
return createPaginatedResponse(response.data ?? [], void 0);
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Get multiple users by their usernames in a single request.
|
|
1094
|
+
*
|
|
1095
|
+
* @param usernames - List of usernames (without @) to fetch.
|
|
1096
|
+
* @returns Paginated response containing the matching users.
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* ```typescript
|
|
1100
|
+
* const users = await client.twitter.users.getByUsernames(["elonmusk", "twitter"]);
|
|
1101
|
+
* for (const user of users.data) {
|
|
1102
|
+
* console.log(`${user.name}: ${user.followers_count?.toLocaleString()} followers`);
|
|
1103
|
+
* }
|
|
1104
|
+
* ```
|
|
1105
|
+
*/
|
|
1106
|
+
async getByUsernames(usernames) {
|
|
1107
|
+
const response = await this.client.request(
|
|
1108
|
+
"/v1/twitter/users/batch_by_usernames",
|
|
1109
|
+
{ params: { usernames: usernames.join(",") } }
|
|
1110
|
+
);
|
|
1111
|
+
return createPaginatedResponse(response.data ?? [], void 0);
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Get tweets that mention a user.
|
|
1115
|
+
*
|
|
1116
|
+
* @param username - The user's username (without @).
|
|
1117
|
+
* @param options - Pagination options with optional count.
|
|
1118
|
+
* @returns Paginated response containing tweets mentioning the user.
|
|
1119
|
+
*
|
|
1120
|
+
* @example
|
|
1121
|
+
* ```typescript
|
|
1122
|
+
* const mentions = await client.twitter.users.getMentions("elonmusk");
|
|
1123
|
+
* for (const tweet of mentions.data) {
|
|
1124
|
+
* console.log(`@${tweet.username}: ${tweet.text.slice(0, 100)}...`);
|
|
1125
|
+
* }
|
|
1126
|
+
* ```
|
|
1127
|
+
*/
|
|
1128
|
+
async getMentions(username, options = {}) {
|
|
1129
|
+
const response = await this.client.request(
|
|
1130
|
+
`/v1/twitter/users/${username}/mentions`,
|
|
1131
|
+
{ params: { count: options.count, cursor: options.cursor } }
|
|
1132
|
+
);
|
|
1133
|
+
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Get long-form articles authored by a user.
|
|
1137
|
+
*
|
|
1138
|
+
* @param userId - The user's numeric ID.
|
|
1139
|
+
* @param options - Pagination options with optional count.
|
|
1140
|
+
* @returns Paginated response containing the user's articles as tweets.
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
* ```typescript
|
|
1144
|
+
* const articles = await client.twitter.users.getArticles("44196397");
|
|
1145
|
+
* for (const article of articles.data) {
|
|
1146
|
+
* console.log(article.text?.slice(0, 100));
|
|
1147
|
+
* }
|
|
1148
|
+
* ```
|
|
1149
|
+
*/
|
|
1150
|
+
async getArticles(userId, options = {}) {
|
|
1151
|
+
const response = await this.client.request(
|
|
1152
|
+
`/v1/twitter/users/${userId}/articles`,
|
|
1153
|
+
{ params: { count: options.count, cursor: options.cursor } }
|
|
1154
|
+
);
|
|
1155
|
+
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
1156
|
+
}
|
|
1018
1157
|
};
|
|
1019
1158
|
|
|
1020
1159
|
// src/twitter/lists.ts
|
|
@@ -1161,6 +1300,29 @@ var ListsClient = class {
|
|
|
1161
1300
|
);
|
|
1162
1301
|
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
1163
1302
|
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Search tweets within a specific list.
|
|
1305
|
+
*
|
|
1306
|
+
* @param listId - The list ID to search within.
|
|
1307
|
+
* @param query - Search query string.
|
|
1308
|
+
* @param options - Pagination options with optional count.
|
|
1309
|
+
* @returns Paginated response containing matching tweets from the list.
|
|
1310
|
+
*
|
|
1311
|
+
* @example
|
|
1312
|
+
* ```typescript
|
|
1313
|
+
* const results = await client.twitter.lists.searchTweets("123456", "python");
|
|
1314
|
+
* for (const tweet of results.data) {
|
|
1315
|
+
* console.log(`@${tweet.username}: ${tweet.text.slice(0, 100)}...`);
|
|
1316
|
+
* }
|
|
1317
|
+
* ```
|
|
1318
|
+
*/
|
|
1319
|
+
async searchTweets(listId, query, options = {}) {
|
|
1320
|
+
const response = await this.client.request(
|
|
1321
|
+
`/v1/twitter/lists/${listId}/search_tweets`,
|
|
1322
|
+
{ params: { query, count: options.count, cursor: options.cursor } }
|
|
1323
|
+
);
|
|
1324
|
+
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
1325
|
+
}
|
|
1164
1326
|
};
|
|
1165
1327
|
|
|
1166
1328
|
// src/twitter/communities.ts
|
|
@@ -2024,7 +2186,7 @@ var StreamClient = class {
|
|
|
2024
2186
|
return;
|
|
2025
2187
|
}
|
|
2026
2188
|
if (!reconnect) {
|
|
2027
|
-
const reasonStr = reason instanceof Buffer ? reason.toString() :
|
|
2189
|
+
const reasonStr = reason instanceof Buffer ? reason.toString() : typeof reason === "string" ? reason : "";
|
|
2028
2190
|
emitter.emit(
|
|
2029
2191
|
"error",
|
|
2030
2192
|
new WebSocketStreamError(`WebSocket closed: ${reasonStr || String(code)}`)
|
|
@@ -2182,6 +2344,46 @@ function verifyWebhookSignature(secret, body, signatureHeader) {
|
|
|
2182
2344
|
}
|
|
2183
2345
|
}
|
|
2184
2346
|
|
|
2347
|
+
// src/twitter/spaces.ts
|
|
2348
|
+
var SpacesClient = class {
|
|
2349
|
+
client;
|
|
2350
|
+
constructor(client) {
|
|
2351
|
+
this.client = client;
|
|
2352
|
+
}
|
|
2353
|
+
/**
|
|
2354
|
+
* Get details for a specific Twitter Space.
|
|
2355
|
+
*
|
|
2356
|
+
* @param spaceId - The Space ID to fetch.
|
|
2357
|
+
* @returns The Space data.
|
|
2358
|
+
* @throws NotFoundError - If the Space doesn't exist.
|
|
2359
|
+
*
|
|
2360
|
+
* @example
|
|
2361
|
+
* ```typescript
|
|
2362
|
+
* const space = await client.twitter.spaces.getDetail("1eaKbrPPbPwKX");
|
|
2363
|
+
* console.log(`${space.title} — ${space.participant_count} participants`);
|
|
2364
|
+
* ```
|
|
2365
|
+
*/
|
|
2366
|
+
async getDetail(spaceId) {
|
|
2367
|
+
return this.client.request(`/v1/twitter/spaces/${spaceId}`);
|
|
2368
|
+
}
|
|
2369
|
+
/**
|
|
2370
|
+
* Get details for a live video broadcast.
|
|
2371
|
+
*
|
|
2372
|
+
* @param broadcastId - The broadcast ID to fetch.
|
|
2373
|
+
* @returns The broadcast data.
|
|
2374
|
+
* @throws NotFoundError - If the broadcast doesn't exist.
|
|
2375
|
+
*
|
|
2376
|
+
* @example
|
|
2377
|
+
* ```typescript
|
|
2378
|
+
* const broadcast = await client.twitter.spaces.getBroadcast("broadcast123");
|
|
2379
|
+
* console.log(`${broadcast.title}: ${broadcast.total_viewers} viewers`);
|
|
2380
|
+
* ```
|
|
2381
|
+
*/
|
|
2382
|
+
async getBroadcast(broadcastId) {
|
|
2383
|
+
return this.client.request(`/v1/twitter/spaces/broadcast/${broadcastId}`);
|
|
2384
|
+
}
|
|
2385
|
+
};
|
|
2386
|
+
|
|
2185
2387
|
// src/twitter/client.ts
|
|
2186
2388
|
var TwitterClient = class {
|
|
2187
2389
|
/** Client for tweet operations */
|
|
@@ -2198,6 +2400,8 @@ var TwitterClient = class {
|
|
|
2198
2400
|
geo;
|
|
2199
2401
|
/** Client for real-time stream monitor management and WebSocket streaming */
|
|
2200
2402
|
stream;
|
|
2403
|
+
/** Client for Twitter Spaces and live broadcast operations */
|
|
2404
|
+
spaces;
|
|
2201
2405
|
/**
|
|
2202
2406
|
* Create a new Twitter client.
|
|
2203
2407
|
*
|
|
@@ -2211,6 +2415,7 @@ var TwitterClient = class {
|
|
|
2211
2415
|
this.trends = new TrendsClient(client);
|
|
2212
2416
|
this.geo = new GeoClient(client);
|
|
2213
2417
|
this.stream = new StreamClient(client);
|
|
2418
|
+
this.spaces = new SpacesClient(client);
|
|
2214
2419
|
}
|
|
2215
2420
|
};
|
|
2216
2421
|
|
|
@@ -2222,94 +2427,845 @@ var WebClient = class {
|
|
|
2222
2427
|
}
|
|
2223
2428
|
/**
|
|
2224
2429
|
* Scrape a web page.
|
|
2430
|
+
*
|
|
2431
|
+
* @param url - The URL to scrape
|
|
2432
|
+
* @param options - Scrape configuration options
|
|
2433
|
+
* @returns The scrape result including content, metadata, and credit usage
|
|
2225
2434
|
*/
|
|
2226
2435
|
async scrape(url, options = {}) {
|
|
2227
2436
|
const body = { url };
|
|
2228
|
-
if (options.
|
|
2229
|
-
if (options.
|
|
2230
|
-
|
|
2231
|
-
if (options.
|
|
2232
|
-
if (options.
|
|
2233
|
-
if (options.
|
|
2234
|
-
if (options.
|
|
2437
|
+
if (options.format !== void 0) body.format = options.format;
|
|
2438
|
+
if (options.renderJs !== void 0) body.render_js = options.renderJs;
|
|
2439
|
+
if (options.engine !== void 0) body.engine = options.engine;
|
|
2440
|
+
if (options.waitFor !== void 0) body.wait_for = options.waitFor;
|
|
2441
|
+
if (options.waitTimeout !== void 0) body.wait_timeout = options.waitTimeout;
|
|
2442
|
+
if (options.waitAfterLoad !== void 0) body.wait_after_load = options.waitAfterLoad;
|
|
2443
|
+
if (options.jsScenario !== void 0) body.js_scenario = options.jsScenario;
|
|
2444
|
+
if (options.sessionId !== void 0) body.session_id = options.sessionId;
|
|
2445
|
+
if (options.retryCount !== void 0) body.retry_count = options.retryCount;
|
|
2446
|
+
if (options.retryOnBlock !== void 0) body.retry_on_block = options.retryOnBlock;
|
|
2447
|
+
if (options.country !== void 0) body.country = options.country;
|
|
2448
|
+
if (options.customHeaders !== void 0) body.custom_headers = options.customHeaders;
|
|
2449
|
+
if (options.screenshot !== void 0) body.screenshot = options.screenshot;
|
|
2450
|
+
if (options.video !== void 0) body.video = options.video;
|
|
2451
|
+
if (options.antiBot !== void 0) body.anti_bot = options.antiBot;
|
|
2452
|
+
if (options.escalate !== void 0) body.escalate = options.escalate;
|
|
2235
2453
|
if (options.maxCost !== void 0) body.max_cost = options.maxCost;
|
|
2236
|
-
if (options.
|
|
2237
|
-
if (options.
|
|
2238
|
-
if (options.
|
|
2239
|
-
if (options.
|
|
2454
|
+
if (options.aiExtract !== void 0) body.ai_extract = options.aiExtract;
|
|
2455
|
+
if (options.aiPrompt !== void 0) body.ai_prompt = options.aiPrompt;
|
|
2456
|
+
if (options.rawContent !== void 0) body.raw_content = options.rawContent;
|
|
2457
|
+
if (options.skipBotDetection !== void 0) body.skip_bot_detection = options.skipBotDetection;
|
|
2240
2458
|
return this.client.request("/v1/web/scrape", {
|
|
2241
2459
|
method: "POST",
|
|
2242
2460
|
body
|
|
2243
2461
|
});
|
|
2244
2462
|
}
|
|
2245
2463
|
/**
|
|
2246
|
-
*
|
|
2464
|
+
* Extract structured data from a web page using AI.
|
|
2465
|
+
*
|
|
2466
|
+
* Convenience wrapper around {@link scrape} that enables AI extraction
|
|
2467
|
+
* with the given prompt and defaults to markdown format.
|
|
2468
|
+
*
|
|
2469
|
+
* @param url - The URL to extract data from
|
|
2470
|
+
* @param prompt - Natural language prompt describing what to extract (max 2000 chars)
|
|
2471
|
+
* @param options - Additional scrape options (aiExtract and aiPrompt are set automatically)
|
|
2472
|
+
* @returns The scrape result with ai_extraction populated
|
|
2247
2473
|
*/
|
|
2248
|
-
async
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
body.viewport_height = options.viewportHeight;
|
|
2255
|
-
if (options.imageFormat && options.imageFormat !== "png")
|
|
2256
|
-
body.image_format = options.imageFormat;
|
|
2257
|
-
if (options.waitFor) body.wait_for = options.waitFor;
|
|
2258
|
-
if (options.timeout !== void 0) body.timeout = options.timeout;
|
|
2259
|
-
return this.client.request("/v1/web/screenshot", {
|
|
2260
|
-
method: "POST",
|
|
2261
|
-
body
|
|
2474
|
+
async extract(url, prompt, options = {}) {
|
|
2475
|
+
return this.scrape(url, {
|
|
2476
|
+
format: "markdown",
|
|
2477
|
+
...options,
|
|
2478
|
+
aiExtract: true,
|
|
2479
|
+
aiPrompt: prompt
|
|
2262
2480
|
});
|
|
2263
2481
|
}
|
|
2264
2482
|
/**
|
|
2265
|
-
*
|
|
2483
|
+
* Detect anti-bot systems on a URL.
|
|
2484
|
+
*
|
|
2485
|
+
* @param url - The URL to analyze
|
|
2486
|
+
* @param options - Detection options
|
|
2487
|
+
* @returns Detection results including identified anti-bot and captcha systems
|
|
2266
2488
|
*/
|
|
2267
|
-
async
|
|
2489
|
+
async detect(url, options = {}) {
|
|
2268
2490
|
const body = { url };
|
|
2269
|
-
if (options.schema) body.extraction_schema = options.schema;
|
|
2270
|
-
if (options.renderJs) body.render_js = true;
|
|
2271
|
-
if (options.waitFor) body.wait_for = options.waitFor;
|
|
2272
2491
|
if (options.timeout !== void 0) body.timeout = options.timeout;
|
|
2273
|
-
|
|
2492
|
+
if (options.country !== void 0) body.country = options.country;
|
|
2493
|
+
return this.client.request("/v1/web/detect", {
|
|
2274
2494
|
method: "POST",
|
|
2275
2495
|
body
|
|
2276
2496
|
});
|
|
2277
2497
|
}
|
|
2498
|
+
};
|
|
2499
|
+
|
|
2500
|
+
// src/vinted/search.ts
|
|
2501
|
+
var SearchClient = class {
|
|
2502
|
+
client;
|
|
2503
|
+
constructor(client) {
|
|
2504
|
+
this.client = client;
|
|
2505
|
+
}
|
|
2278
2506
|
/**
|
|
2279
|
-
*
|
|
2507
|
+
* Search for Vinted items.
|
|
2508
|
+
*
|
|
2509
|
+
* @param params - Search parameters including query, filters, and pagination.
|
|
2510
|
+
* @returns Search results with items and pagination metadata.
|
|
2511
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2512
|
+
* @throws ValidationError - If the search parameters are invalid.
|
|
2513
|
+
*
|
|
2514
|
+
* @example
|
|
2515
|
+
* ```typescript
|
|
2516
|
+
* const results = await client.vinted.search.search({
|
|
2517
|
+
* query: "vintage jacket",
|
|
2518
|
+
* market: "fr",
|
|
2519
|
+
* page: 1,
|
|
2520
|
+
* per_page: 20,
|
|
2521
|
+
* order: "newest_first",
|
|
2522
|
+
* });
|
|
2523
|
+
* console.log(`Found ${results.pagination.total_entries} items`);
|
|
2524
|
+
* ```
|
|
2280
2525
|
*/
|
|
2281
|
-
async
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2526
|
+
async search(params) {
|
|
2527
|
+
return this.client.request("/v1/vinted/search", {
|
|
2528
|
+
params: {
|
|
2529
|
+
query: params.query,
|
|
2530
|
+
market: params.market,
|
|
2531
|
+
page: params.page,
|
|
2532
|
+
per_page: params.per_page,
|
|
2533
|
+
price_from: params.price_from,
|
|
2534
|
+
price_to: params.price_to,
|
|
2535
|
+
brand_ids: params.brand_ids,
|
|
2536
|
+
color_ids: params.color_ids,
|
|
2537
|
+
status_ids: params.status_ids,
|
|
2538
|
+
order: params.order
|
|
2539
|
+
}
|
|
2293
2540
|
});
|
|
2294
2541
|
}
|
|
2542
|
+
};
|
|
2543
|
+
|
|
2544
|
+
// src/vinted/items.ts
|
|
2545
|
+
var ItemsClient = class {
|
|
2546
|
+
client;
|
|
2547
|
+
constructor(client) {
|
|
2548
|
+
this.client = client;
|
|
2549
|
+
}
|
|
2295
2550
|
/**
|
|
2296
|
-
*
|
|
2551
|
+
* Get a single item by ID.
|
|
2552
|
+
*
|
|
2553
|
+
* @param itemId - The Vinted item ID to fetch.
|
|
2554
|
+
* @param options - Optional parameters.
|
|
2555
|
+
* @param options.market - Market code (default: "fr").
|
|
2556
|
+
* @returns The item detail response including full item data.
|
|
2557
|
+
* @throws NotFoundError - If the item doesn't exist.
|
|
2558
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2559
|
+
*
|
|
2560
|
+
* @example
|
|
2561
|
+
* ```typescript
|
|
2562
|
+
* const response = await client.vinted.items.get(123456789);
|
|
2563
|
+
* const { item } = response;
|
|
2564
|
+
* console.log(`${item.title}: ${item.description}`);
|
|
2565
|
+
* console.log(`Brand: ${item.brand_title}, Size: ${item.size_title}`);
|
|
2566
|
+
* console.log(`Photos: ${item.photos.length}`);
|
|
2567
|
+
* ```
|
|
2297
2568
|
*/
|
|
2298
|
-
async
|
|
2299
|
-
return this.client.request(
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2569
|
+
async get(itemId, options = {}) {
|
|
2570
|
+
return this.client.request(
|
|
2571
|
+
`/v1/vinted/items/${itemId}`,
|
|
2572
|
+
{ params: { market: options.market } }
|
|
2573
|
+
);
|
|
2574
|
+
}
|
|
2575
|
+
};
|
|
2576
|
+
|
|
2577
|
+
// src/vinted/users.ts
|
|
2578
|
+
var UsersClient2 = class {
|
|
2579
|
+
client;
|
|
2580
|
+
constructor(client) {
|
|
2581
|
+
this.client = client;
|
|
2582
|
+
}
|
|
2583
|
+
/**
|
|
2584
|
+
* Get a user's profile.
|
|
2585
|
+
*
|
|
2586
|
+
* @param userId - The Vinted user ID.
|
|
2587
|
+
* @param options - Optional parameters.
|
|
2588
|
+
* @param options.market - Market code (default: "fr").
|
|
2589
|
+
* @returns The user profile response.
|
|
2590
|
+
* @throws NotFoundError - If the user doesn't exist.
|
|
2591
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2592
|
+
*
|
|
2593
|
+
* @example
|
|
2594
|
+
* ```typescript
|
|
2595
|
+
* const response = await client.vinted.users.getProfile(12345);
|
|
2596
|
+
* const { user } = response;
|
|
2597
|
+
* console.log(`${user.login} from ${user.city}, ${user.country_code}`);
|
|
2598
|
+
* console.log(`Reputation: ${user.feedback_reputation}`);
|
|
2599
|
+
* console.log(`Items: ${user.item_count}, Followers: ${user.followers_count}`);
|
|
2600
|
+
* ```
|
|
2601
|
+
*/
|
|
2602
|
+
async getProfile(userId, options = {}) {
|
|
2603
|
+
return this.client.request(
|
|
2604
|
+
`/v1/vinted/users/${userId}`,
|
|
2605
|
+
{ params: { market: options.market } }
|
|
2606
|
+
);
|
|
2607
|
+
}
|
|
2608
|
+
/**
|
|
2609
|
+
* Get items listed by a user.
|
|
2610
|
+
*
|
|
2611
|
+
* @param userId - The Vinted user ID.
|
|
2612
|
+
* @param options - Optional parameters for pagination and market.
|
|
2613
|
+
* @param options.market - Market code (default: "fr").
|
|
2614
|
+
* @param options.page - Page number.
|
|
2615
|
+
* @param options.per_page - Items per page.
|
|
2616
|
+
* @returns The user's items with pagination metadata.
|
|
2617
|
+
* @throws NotFoundError - If the user doesn't exist.
|
|
2618
|
+
* @throws AuthenticationError - If the API key is invalid.
|
|
2619
|
+
*
|
|
2620
|
+
* @example
|
|
2621
|
+
* ```typescript
|
|
2622
|
+
* const response = await client.vinted.users.getItems(12345, {
|
|
2623
|
+
* market: "de",
|
|
2624
|
+
* page: 1,
|
|
2625
|
+
* per_page: 20,
|
|
2626
|
+
* });
|
|
2627
|
+
* console.log(`Page ${response.pagination.current_page} of ${response.pagination.total_pages}`);
|
|
2628
|
+
* for (const item of response.items) {
|
|
2629
|
+
* console.log(`${item.title} — ${item.price.amount} ${item.price.currency_code}`);
|
|
2630
|
+
* }
|
|
2631
|
+
* ```
|
|
2632
|
+
*/
|
|
2633
|
+
async getItems(userId, options = {}) {
|
|
2634
|
+
return this.client.request(
|
|
2635
|
+
`/v1/vinted/users/${userId}/items`,
|
|
2636
|
+
{
|
|
2637
|
+
params: {
|
|
2638
|
+
market: options.market,
|
|
2639
|
+
page: options.page,
|
|
2640
|
+
per_page: options.per_page
|
|
2641
|
+
}
|
|
2305
2642
|
}
|
|
2643
|
+
);
|
|
2644
|
+
}
|
|
2645
|
+
};
|
|
2646
|
+
|
|
2647
|
+
// src/vinted/reference.ts
|
|
2648
|
+
var ReferenceClient = class {
|
|
2649
|
+
client;
|
|
2650
|
+
constructor(client) {
|
|
2651
|
+
this.client = client;
|
|
2652
|
+
}
|
|
2653
|
+
/**
|
|
2654
|
+
* Search for brands by keyword.
|
|
2655
|
+
*
|
|
2656
|
+
* @param options - Optional parameters.
|
|
2657
|
+
* @param options.keyword - Brand name to search for.
|
|
2658
|
+
* @param options.market - Market code (default: "fr").
|
|
2659
|
+
* @param options.per_page - Number of results per page.
|
|
2660
|
+
* @returns Brands matching the keyword.
|
|
2661
|
+
*
|
|
2662
|
+
* @example
|
|
2663
|
+
* ```typescript
|
|
2664
|
+
* const response = await client.vinted.reference.brands({
|
|
2665
|
+
* keyword: "adidas",
|
|
2666
|
+
* market: "de",
|
|
2667
|
+
* per_page: 10,
|
|
2668
|
+
* });
|
|
2669
|
+
* for (const brand of response.brands) {
|
|
2670
|
+
* console.log(`${brand.title} (${brand.slug}): ${brand.item_count} items`);
|
|
2671
|
+
* }
|
|
2672
|
+
* ```
|
|
2673
|
+
*/
|
|
2674
|
+
async brands(options = {}) {
|
|
2675
|
+
return this.client.request("/v1/vinted/brands", {
|
|
2676
|
+
params: {
|
|
2677
|
+
keyword: options.keyword,
|
|
2678
|
+
market: options.market,
|
|
2679
|
+
per_page: options.per_page
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
}
|
|
2683
|
+
/**
|
|
2684
|
+
* Get available colors for a market.
|
|
2685
|
+
*
|
|
2686
|
+
* @param options - Optional parameters.
|
|
2687
|
+
* @param options.market - Market code (default: "fr").
|
|
2688
|
+
* @returns List of available colors.
|
|
2689
|
+
*
|
|
2690
|
+
* @example
|
|
2691
|
+
* ```typescript
|
|
2692
|
+
* const response = await client.vinted.reference.colors({ market: "fr" });
|
|
2693
|
+
* for (const color of response.colors) {
|
|
2694
|
+
* console.log(`${color.title} (#${color.hex})`);
|
|
2695
|
+
* }
|
|
2696
|
+
* ```
|
|
2697
|
+
*/
|
|
2698
|
+
async colors(options = {}) {
|
|
2699
|
+
return this.client.request("/v1/vinted/colors", {
|
|
2700
|
+
params: { market: options.market }
|
|
2701
|
+
});
|
|
2702
|
+
}
|
|
2703
|
+
/**
|
|
2704
|
+
* Get available item condition statuses for a market.
|
|
2705
|
+
*
|
|
2706
|
+
* @param options - Optional parameters.
|
|
2707
|
+
* @param options.market - Market code (default: "fr").
|
|
2708
|
+
* @returns List of item condition statuses.
|
|
2709
|
+
*
|
|
2710
|
+
* @example
|
|
2711
|
+
* ```typescript
|
|
2712
|
+
* const response = await client.vinted.reference.statuses({ market: "fr" });
|
|
2713
|
+
* for (const status of response.statuses) {
|
|
2714
|
+
* console.log(`${status.id}: ${status.title}`);
|
|
2715
|
+
* }
|
|
2716
|
+
* ```
|
|
2717
|
+
*/
|
|
2718
|
+
async statuses(options = {}) {
|
|
2719
|
+
return this.client.request("/v1/vinted/statuses", {
|
|
2720
|
+
params: { market: options.market }
|
|
2721
|
+
});
|
|
2722
|
+
}
|
|
2723
|
+
/**
|
|
2724
|
+
* Get all available Vinted markets.
|
|
2725
|
+
*
|
|
2726
|
+
* @returns List of all supported Vinted markets/countries.
|
|
2727
|
+
*
|
|
2728
|
+
* @example
|
|
2729
|
+
* ```typescript
|
|
2730
|
+
* const response = await client.vinted.reference.markets();
|
|
2731
|
+
* for (const market of response.markets) {
|
|
2732
|
+
* console.log(`${market.name}: ${market.domain} (${market.currency})`);
|
|
2733
|
+
* }
|
|
2734
|
+
* ```
|
|
2735
|
+
*/
|
|
2736
|
+
async markets() {
|
|
2737
|
+
return this.client.request("/v1/vinted/markets");
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
|
|
2741
|
+
// src/vinted/client.ts
|
|
2742
|
+
var VintedClient = class {
|
|
2743
|
+
/** Client for item search operations */
|
|
2744
|
+
search;
|
|
2745
|
+
/** Client for individual item operations */
|
|
2746
|
+
items;
|
|
2747
|
+
/** Client for user operations */
|
|
2748
|
+
users;
|
|
2749
|
+
/** Client for reference data (brands, colors, statuses, markets) */
|
|
2750
|
+
reference;
|
|
2751
|
+
/**
|
|
2752
|
+
* Create a new Vinted client.
|
|
2753
|
+
*
|
|
2754
|
+
* @param client - The base HTTP client for making requests.
|
|
2755
|
+
*/
|
|
2756
|
+
constructor(client) {
|
|
2757
|
+
this.search = new SearchClient(client);
|
|
2758
|
+
this.items = new ItemsClient(client);
|
|
2759
|
+
this.users = new UsersClient2(client);
|
|
2760
|
+
this.reference = new ReferenceClient(client);
|
|
2761
|
+
}
|
|
2762
|
+
};
|
|
2763
|
+
|
|
2764
|
+
// src/google/ai-mode.ts
|
|
2765
|
+
var AiModeClient = class {
|
|
2766
|
+
constructor(client) {
|
|
2767
|
+
this.client = client;
|
|
2768
|
+
}
|
|
2769
|
+
async search(params) {
|
|
2770
|
+
return this.client.request("/v1/google/ai-mode/search", {
|
|
2771
|
+
params: { ...params }
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2774
|
+
};
|
|
2775
|
+
|
|
2776
|
+
// src/google/autocomplete.ts
|
|
2777
|
+
var AutocompleteClient = class {
|
|
2778
|
+
constructor(client) {
|
|
2779
|
+
this.client = client;
|
|
2780
|
+
}
|
|
2781
|
+
/**
|
|
2782
|
+
* Get Google autocomplete suggestions for a query.
|
|
2783
|
+
*
|
|
2784
|
+
* @example
|
|
2785
|
+
* ```typescript
|
|
2786
|
+
* const res = await client.google.autocomplete.get({ q: "apple" });
|
|
2787
|
+
* for (const s of res.suggestions) {
|
|
2788
|
+
* console.log(s.value, s.entity_name, s.thumbnail);
|
|
2789
|
+
* }
|
|
2790
|
+
* ```
|
|
2791
|
+
*/
|
|
2792
|
+
async get(params) {
|
|
2793
|
+
return this.client.request("/v1/google/autocomplete", {
|
|
2794
|
+
params: { ...params }
|
|
2795
|
+
});
|
|
2796
|
+
}
|
|
2797
|
+
};
|
|
2798
|
+
|
|
2799
|
+
// src/google/finance.ts
|
|
2800
|
+
var FinanceClient = class {
|
|
2801
|
+
constructor(client) {
|
|
2802
|
+
this.client = client;
|
|
2803
|
+
}
|
|
2804
|
+
async quote(params) {
|
|
2805
|
+
return this.client.request("/v1/google/finance/quote", {
|
|
2806
|
+
params: { ...params }
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
};
|
|
2810
|
+
|
|
2811
|
+
// src/google/flights.ts
|
|
2812
|
+
var FlightsClient = class {
|
|
2813
|
+
constructor(client) {
|
|
2814
|
+
this.client = client;
|
|
2815
|
+
}
|
|
2816
|
+
/** Search Google Flights for available itineraries. */
|
|
2817
|
+
async search(params) {
|
|
2818
|
+
return this.client.request("/v1/google/flights/search", {
|
|
2819
|
+
params: { ...params }
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
};
|
|
2823
|
+
|
|
2824
|
+
// src/google/hotels.ts
|
|
2825
|
+
var HotelsClient = class {
|
|
2826
|
+
constructor(client) {
|
|
2827
|
+
this.client = client;
|
|
2828
|
+
}
|
|
2829
|
+
async search(params) {
|
|
2830
|
+
return this.client.request("/v1/google/hotels/search", {
|
|
2831
|
+
params: { ...params }
|
|
2832
|
+
});
|
|
2833
|
+
}
|
|
2834
|
+
async details(params) {
|
|
2835
|
+
return this.client.request("/v1/google/hotels/details", {
|
|
2836
|
+
params: { ...params }
|
|
2837
|
+
});
|
|
2838
|
+
}
|
|
2839
|
+
};
|
|
2840
|
+
|
|
2841
|
+
// src/google/images.ts
|
|
2842
|
+
var ImagesClient = class {
|
|
2843
|
+
constructor(client) {
|
|
2844
|
+
this.client = client;
|
|
2845
|
+
}
|
|
2846
|
+
async search(params) {
|
|
2847
|
+
return this.client.request("/v1/google/images/search", {
|
|
2848
|
+
params: { ...params }
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
};
|
|
2852
|
+
|
|
2853
|
+
// src/google/jobs.ts
|
|
2854
|
+
var JobsClient = class {
|
|
2855
|
+
constructor(client) {
|
|
2856
|
+
this.client = client;
|
|
2857
|
+
}
|
|
2858
|
+
async search(params) {
|
|
2859
|
+
return this.client.request("/v1/google/jobs/search", {
|
|
2860
|
+
params: { ...params }
|
|
2861
|
+
});
|
|
2862
|
+
}
|
|
2863
|
+
};
|
|
2864
|
+
|
|
2865
|
+
// src/google/lens.ts
|
|
2866
|
+
var LensClient = class {
|
|
2867
|
+
constructor(client) {
|
|
2868
|
+
this.client = client;
|
|
2869
|
+
}
|
|
2870
|
+
async search(params) {
|
|
2871
|
+
return this.client.request("/v1/google/lens/search", {
|
|
2872
|
+
params: { ...params }
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
};
|
|
2876
|
+
|
|
2877
|
+
// src/google/maps.ts
|
|
2878
|
+
var MapsClient = class {
|
|
2879
|
+
constructor(client) {
|
|
2880
|
+
this.client = client;
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Search Maps for places by text query, place_id, or ludocid.
|
|
2884
|
+
*
|
|
2885
|
+
* Returns up to 20 results per page with full details (place_id,
|
|
2886
|
+
* data_id, GPS, rating, reviews, address, phone, website, extensions,
|
|
2887
|
+
* weekly hours, thumbnail) in a single call.
|
|
2888
|
+
*/
|
|
2889
|
+
async search(params) {
|
|
2890
|
+
if (!params.q && !params.place_id && !params.ludocid) {
|
|
2891
|
+
throw new Error("q, place_id, or ludocid is required");
|
|
2892
|
+
}
|
|
2893
|
+
return this.client.request("/v1/google/maps/search", {
|
|
2894
|
+
params: { ...params }
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
/**
|
|
2898
|
+
* Get full place detail by `place_id` or `data_id`.
|
|
2899
|
+
*
|
|
2900
|
+
* Returns title, address, phone, website, GPS, rating, reviews_count,
|
|
2901
|
+
* rating_summary (per-star distribution), categories, extensions
|
|
2902
|
+
* (service_options, accessibility, offerings, payments), weekly
|
|
2903
|
+
* operating hours, popular_times graph, provider_id,
|
|
2904
|
+
* permanently_closed, thumbnail, and photo list.
|
|
2905
|
+
*/
|
|
2906
|
+
async place(params) {
|
|
2907
|
+
if (!params.place_id && !params.data_id) {
|
|
2908
|
+
throw new Error("place_id or data_id is required");
|
|
2909
|
+
}
|
|
2910
|
+
return this.client.request("/v1/google/maps/place", {
|
|
2911
|
+
params: { ...params }
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2914
|
+
/**
|
|
2915
|
+
* Get reviews for a place (paginated, optional topic filter).
|
|
2916
|
+
*
|
|
2917
|
+
* Pass the `next_page_token` from `response.pagination.next` for
|
|
2918
|
+
* subsequent pages, or use `topic_id` from `response.topics[].id`
|
|
2919
|
+
* to scope to a specific review topic.
|
|
2920
|
+
*/
|
|
2921
|
+
async reviews(params) {
|
|
2922
|
+
return this.client.request("/v1/google/maps/reviews", {
|
|
2923
|
+
params: { ...params }
|
|
2924
|
+
});
|
|
2925
|
+
}
|
|
2926
|
+
/**
|
|
2927
|
+
* Get photos for a place with place-specific categories.
|
|
2928
|
+
*
|
|
2929
|
+
* Returns place-specific categories (Menu, Vibe, Comfort food, dish
|
|
2930
|
+
* names) and photo URLs from all CDN families. Use `category_id` to
|
|
2931
|
+
* scope to a category, or `page_size: 200` to fetch all photos in
|
|
2932
|
+
* one call (Google caps at ~120 photos per response).
|
|
2933
|
+
*/
|
|
2934
|
+
async photos(params) {
|
|
2935
|
+
return this.client.request("/v1/google/maps/photos", {
|
|
2936
|
+
params: { ...params }
|
|
2937
|
+
});
|
|
2938
|
+
}
|
|
2939
|
+
/** Get business posts (promotional updates, announcements) for a place. */
|
|
2940
|
+
async posts(params) {
|
|
2941
|
+
if (!params.data_id && !params.place_id) {
|
|
2942
|
+
throw new Error("data_id or place_id is required");
|
|
2943
|
+
}
|
|
2944
|
+
return this.client.request("/v1/google/maps/posts", {
|
|
2945
|
+
params: { ...params }
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
};
|
|
2949
|
+
|
|
2950
|
+
// src/google/news.ts
|
|
2951
|
+
var NewsClient = class {
|
|
2952
|
+
constructor(client) {
|
|
2953
|
+
this.client = client;
|
|
2954
|
+
}
|
|
2955
|
+
/**
|
|
2956
|
+
* Search Google News. One of `q`, `topic_token`, `publication_token`,
|
|
2957
|
+
* or `story_token` is required (or pass no params for the trending
|
|
2958
|
+
* home feed). Returns `menu_links`, `news_results`, `related_topics`.
|
|
2959
|
+
*/
|
|
2960
|
+
async search(params = {}) {
|
|
2961
|
+
if (!params.q && !params.topic_token && !params.publication_token && !params.story_token) {
|
|
2962
|
+
throw new Error("Provide q, topic_token, publication_token, or story_token");
|
|
2963
|
+
}
|
|
2964
|
+
return this.client.request("/v1/google/news/search", {
|
|
2965
|
+
params: { ...params }
|
|
2966
|
+
});
|
|
2967
|
+
}
|
|
2968
|
+
async topics(params) {
|
|
2969
|
+
return this.client.request("/v1/google/news/topics", {
|
|
2970
|
+
params: { ...params }
|
|
2971
|
+
});
|
|
2972
|
+
}
|
|
2973
|
+
async trending(params = {}) {
|
|
2974
|
+
return this.client.request("/v1/google/news/trending", {
|
|
2975
|
+
params: { ...params }
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
};
|
|
2979
|
+
|
|
2980
|
+
// src/google/patents.ts
|
|
2981
|
+
var PatentsClient = class {
|
|
2982
|
+
constructor(client) {
|
|
2983
|
+
this.client = client;
|
|
2984
|
+
}
|
|
2985
|
+
async search(params) {
|
|
2986
|
+
return this.client.request("/v1/google/patents/search", {
|
|
2987
|
+
params: { ...params }
|
|
2988
|
+
});
|
|
2989
|
+
}
|
|
2990
|
+
/**
|
|
2991
|
+
* Get rich patent document details by patent number.
|
|
2992
|
+
*
|
|
2993
|
+
* Response includes full abstract + every claim + complete description,
|
|
2994
|
+
* plus structured `cpc_classifications` (code + description), split
|
|
2995
|
+
* `backward_citations` / `forward_citations` (with `primary_examiner`
|
|
2996
|
+
* flag), `non_patent_citations`, `concepts` (research fields),
|
|
2997
|
+
* `legal_events` (prosecution history), `figures` (full-res URLs),
|
|
2998
|
+
* every `inventor`, and the full `assignees_original` history.
|
|
2999
|
+
*/
|
|
3000
|
+
async detail(params) {
|
|
3001
|
+
return this.client.request("/v1/google/patents/detail", {
|
|
3002
|
+
params: { ...params }
|
|
3003
|
+
});
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
3006
|
+
|
|
3007
|
+
// src/google/products.ts
|
|
3008
|
+
var ProductsClient = class {
|
|
3009
|
+
constructor(client) {
|
|
3010
|
+
this.client = client;
|
|
3011
|
+
}
|
|
3012
|
+
async detail(params) {
|
|
3013
|
+
return this.client.request("/v1/google/products/detail", {
|
|
3014
|
+
params: { ...params }
|
|
3015
|
+
});
|
|
3016
|
+
}
|
|
3017
|
+
};
|
|
3018
|
+
|
|
3019
|
+
// src/google/scholar.ts
|
|
3020
|
+
var ScholarClient = class {
|
|
3021
|
+
constructor(client) {
|
|
3022
|
+
this.client = client;
|
|
3023
|
+
}
|
|
3024
|
+
/**
|
|
3025
|
+
* Search Google Scholar. Returns each result with doc `id`, `type`
|
|
3026
|
+
* badge, wrapped `inline_links`, PDF `resources`, and structured
|
|
3027
|
+
* authors. Envelope includes `scholar_results` alias,
|
|
3028
|
+
* `related_searches`, and matched `profiles` cards.
|
|
3029
|
+
*/
|
|
3030
|
+
async search(params) {
|
|
3031
|
+
return this.client.request("/v1/google/scholar/search", {
|
|
3032
|
+
params: { ...params }
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
/** Search Google Scholar for author profiles by name. */
|
|
3036
|
+
async profiles(params) {
|
|
3037
|
+
return this.client.request("/v1/google/scholar/profiles", {
|
|
3038
|
+
params: { ...params }
|
|
3039
|
+
});
|
|
3040
|
+
}
|
|
3041
|
+
/**
|
|
3042
|
+
* Full Scholar author profile: structured `interests_detailed`,
|
|
3043
|
+
* publications (with per-article `citation_id` + nested
|
|
3044
|
+
* `cited_by{value, link, citation_id}`), stats, and co-authors.
|
|
3045
|
+
*/
|
|
3046
|
+
async author(params) {
|
|
3047
|
+
return this.client.request("/v1/google/scholar/author", {
|
|
3048
|
+
params: { ...params }
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
/** Citations-per-year chart for a Scholar author. */
|
|
3052
|
+
async authorCitation(params) {
|
|
3053
|
+
return this.client.request("/v1/google/scholar/author/citation", {
|
|
3054
|
+
params: { ...params }
|
|
3055
|
+
});
|
|
3056
|
+
}
|
|
3057
|
+
/**
|
|
3058
|
+
* MLA / APA / Chicago / Harvard / Vancouver citation formats plus
|
|
3059
|
+
* BibTeX / RIS / EndNote / RefWorks export links for a paper.
|
|
3060
|
+
*/
|
|
3061
|
+
async cite(params) {
|
|
3062
|
+
return this.client.request("/v1/google/scholar/cite", {
|
|
3063
|
+
params: { ...params }
|
|
3064
|
+
});
|
|
3065
|
+
}
|
|
3066
|
+
};
|
|
3067
|
+
|
|
3068
|
+
// src/google/search.ts
|
|
3069
|
+
var SearchClient2 = class {
|
|
3070
|
+
constructor(client) {
|
|
3071
|
+
this.client = client;
|
|
3072
|
+
}
|
|
3073
|
+
/**
|
|
3074
|
+
* Search Google and get a structured SERP response with organic results,
|
|
3075
|
+
* knowledge graph, People Also Ask, related searches, AI overview, and
|
|
3076
|
+
* pagination.
|
|
3077
|
+
*/
|
|
3078
|
+
async search(params) {
|
|
3079
|
+
return this.client.request("/v1/google/search", { params: { ...params } });
|
|
3080
|
+
}
|
|
3081
|
+
/**
|
|
3082
|
+
* Lightweight Google Search — organic results + related searches only.
|
|
3083
|
+
*
|
|
3084
|
+
* ~40% faster than {@link search}. Skips ads, Knowledge Graph, AI
|
|
3085
|
+
* Overview, local pack, news, inline videos, and shopping blocks.
|
|
3086
|
+
* Credit cost is configured per-endpoint by admins — query
|
|
3087
|
+
* `/public/pricing` for the live rate.
|
|
3088
|
+
*
|
|
3089
|
+
* @example
|
|
3090
|
+
* ```typescript
|
|
3091
|
+
* const lite = await client.google.search.light({ q: "python 3.13" });
|
|
3092
|
+
* ```
|
|
3093
|
+
*/
|
|
3094
|
+
async light(params) {
|
|
3095
|
+
return this.client.request("/v1/google/search", {
|
|
3096
|
+
params: { ...params, mode: "fast" }
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
3099
|
+
};
|
|
3100
|
+
|
|
3101
|
+
// src/google/shopping.ts
|
|
3102
|
+
var ShoppingClient = class {
|
|
3103
|
+
constructor(client) {
|
|
3104
|
+
this.client = client;
|
|
3105
|
+
}
|
|
3106
|
+
/** Search Google Shopping for products. */
|
|
3107
|
+
async search(params) {
|
|
3108
|
+
return this.client.request("/v1/google/shopping/search", {
|
|
3109
|
+
params: { ...params }
|
|
3110
|
+
});
|
|
3111
|
+
}
|
|
3112
|
+
/** Fetch the Google Shopping product detail page by `product_id`. */
|
|
3113
|
+
async product(params) {
|
|
3114
|
+
return this.client.request("/v1/google/shopping/product", {
|
|
3115
|
+
params: { ...params }
|
|
2306
3116
|
});
|
|
2307
3117
|
}
|
|
2308
3118
|
/**
|
|
2309
|
-
*
|
|
3119
|
+
* Resolve the direct merchant URL for a Shopping product tile via
|
|
3120
|
+
* Google's "I'm Feeling Lucky" redirect (scoped to the card's `source`
|
|
3121
|
+
* merchant via the `site:` operator). You only pay for the call when
|
|
3122
|
+
* you actually want the merchant link — no bulk enrichment of every
|
|
3123
|
+
* tile.
|
|
2310
3124
|
*/
|
|
2311
|
-
async
|
|
2312
|
-
return this.
|
|
3125
|
+
async click(params) {
|
|
3126
|
+
return this.client.request("/v1/google/shopping/product/click", {
|
|
3127
|
+
params: { ...params }
|
|
3128
|
+
});
|
|
3129
|
+
}
|
|
3130
|
+
};
|
|
3131
|
+
|
|
3132
|
+
// src/google/shorts.ts
|
|
3133
|
+
var ShortsClient = class {
|
|
3134
|
+
constructor(client) {
|
|
3135
|
+
this.client = client;
|
|
3136
|
+
}
|
|
3137
|
+
async search(params) {
|
|
3138
|
+
return this.client.request("/v1/google/shorts/search", {
|
|
3139
|
+
params: { ...params }
|
|
3140
|
+
});
|
|
3141
|
+
}
|
|
3142
|
+
};
|
|
3143
|
+
|
|
3144
|
+
// src/google/trends.ts
|
|
3145
|
+
var TrendsClient2 = class {
|
|
3146
|
+
constructor(client) {
|
|
3147
|
+
this.client = client;
|
|
3148
|
+
}
|
|
3149
|
+
async interest(params) {
|
|
3150
|
+
return this.client.request("/v1/google/trends/interest", {
|
|
3151
|
+
params: { ...params }
|
|
3152
|
+
});
|
|
3153
|
+
}
|
|
3154
|
+
async regions(params) {
|
|
3155
|
+
return this.client.request("/v1/google/trends/regions", {
|
|
3156
|
+
params: { ...params }
|
|
3157
|
+
});
|
|
3158
|
+
}
|
|
3159
|
+
async related(params) {
|
|
3160
|
+
return this.client.request("/v1/google/trends/related", {
|
|
3161
|
+
params: { ...params }
|
|
3162
|
+
});
|
|
3163
|
+
}
|
|
3164
|
+
async trending(params = {}) {
|
|
3165
|
+
return this.client.request("/v1/google/trends/trending", {
|
|
3166
|
+
params: { ...params }
|
|
3167
|
+
});
|
|
3168
|
+
}
|
|
3169
|
+
/**
|
|
3170
|
+
* Current trending searches with the full Google Trends UI filter set
|
|
3171
|
+
* — `geo`, `hours`, `category`, `status`, `sort`, `hl`.
|
|
3172
|
+
*/
|
|
3173
|
+
async trendingNow(params = {}) {
|
|
3174
|
+
return this.client.request("/v1/google/trends/trending-now", {
|
|
3175
|
+
params: { ...params }
|
|
3176
|
+
});
|
|
3177
|
+
}
|
|
3178
|
+
/**
|
|
3179
|
+
* Unified Google Trends query — pick the response shape via
|
|
3180
|
+
* `data_type` (TIMESERIES | GEO_MAP | GEO_MAP_0 | RELATED_TOPICS |
|
|
3181
|
+
* RELATED_QUERIES).
|
|
3182
|
+
*/
|
|
3183
|
+
async search(params) {
|
|
3184
|
+
return this.client.request("/v1/google/trends/search", {
|
|
3185
|
+
params: { ...params }
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
/**
|
|
3189
|
+
* Return categorized Knowledge Graph topic entities (`mid`, `type`,
|
|
3190
|
+
* direct link into Trends explore) for a query prefix. Distinct from
|
|
3191
|
+
* Google Search autocomplete.
|
|
3192
|
+
*/
|
|
3193
|
+
async autocomplete(params) {
|
|
3194
|
+
return this.client.request("/v1/google/trends/autocomplete", {
|
|
3195
|
+
params: { ...params }
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
};
|
|
3199
|
+
|
|
3200
|
+
// src/google/videos.ts
|
|
3201
|
+
var VideosClient = class {
|
|
3202
|
+
constructor(client) {
|
|
3203
|
+
this.client = client;
|
|
3204
|
+
}
|
|
3205
|
+
async search(params) {
|
|
3206
|
+
return this.client.request("/v1/google/videos/search", {
|
|
3207
|
+
params: { ...params }
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
};
|
|
3211
|
+
|
|
3212
|
+
// src/google/client.ts
|
|
3213
|
+
var GoogleClient = class {
|
|
3214
|
+
/** Google Web Search (SERP) — with optional deferred AI Overview follow-up. */
|
|
3215
|
+
search;
|
|
3216
|
+
/** Google Maps — places, reviews, photos, posts. */
|
|
3217
|
+
maps;
|
|
3218
|
+
/** Google News — articles, topics, trending. */
|
|
3219
|
+
news;
|
|
3220
|
+
/** Google Hotels — search and property details. */
|
|
3221
|
+
hotels;
|
|
3222
|
+
/** Google Trends — interest, regions, related, trending, topic autocomplete. */
|
|
3223
|
+
trends;
|
|
3224
|
+
/** Google Jobs. */
|
|
3225
|
+
jobs;
|
|
3226
|
+
/** Google Shopping — search, details, click enrichment. */
|
|
3227
|
+
shopping;
|
|
3228
|
+
/** Google Patents — search and document details. */
|
|
3229
|
+
patents;
|
|
3230
|
+
/** Google Scholar — search, profiles, author, author citation, cite formats. */
|
|
3231
|
+
scholar;
|
|
3232
|
+
/** Google Autocomplete — search suggestions. */
|
|
3233
|
+
autocomplete;
|
|
3234
|
+
/** Google Images. */
|
|
3235
|
+
images;
|
|
3236
|
+
/** Google Videos. */
|
|
3237
|
+
videos;
|
|
3238
|
+
/** Google Finance — stock and index quotes. */
|
|
3239
|
+
finance;
|
|
3240
|
+
/** Google AI Mode — generative answer responses. */
|
|
3241
|
+
aiMode;
|
|
3242
|
+
/** Google Lens — visual image search. */
|
|
3243
|
+
lens;
|
|
3244
|
+
/** Google Shorts — short-form vertical video results (udm=39). */
|
|
3245
|
+
shorts;
|
|
3246
|
+
/** Google Flights — one-way, round-trip, and multi-city itineraries. */
|
|
3247
|
+
flights;
|
|
3248
|
+
/** Google Products — immersive product detail. */
|
|
3249
|
+
products;
|
|
3250
|
+
constructor(client) {
|
|
3251
|
+
this.search = new SearchClient2(client);
|
|
3252
|
+
this.maps = new MapsClient(client);
|
|
3253
|
+
this.news = new NewsClient(client);
|
|
3254
|
+
this.hotels = new HotelsClient(client);
|
|
3255
|
+
this.trends = new TrendsClient2(client);
|
|
3256
|
+
this.jobs = new JobsClient(client);
|
|
3257
|
+
this.shopping = new ShoppingClient(client);
|
|
3258
|
+
this.patents = new PatentsClient(client);
|
|
3259
|
+
this.scholar = new ScholarClient(client);
|
|
3260
|
+
this.autocomplete = new AutocompleteClient(client);
|
|
3261
|
+
this.images = new ImagesClient(client);
|
|
3262
|
+
this.videos = new VideosClient(client);
|
|
3263
|
+
this.finance = new FinanceClient(client);
|
|
3264
|
+
this.aiMode = new AiModeClient(client);
|
|
3265
|
+
this.lens = new LensClient(client);
|
|
3266
|
+
this.shorts = new ShortsClient(client);
|
|
3267
|
+
this.flights = new FlightsClient(client);
|
|
3268
|
+
this.products = new ProductsClient(client);
|
|
2313
3269
|
}
|
|
2314
3270
|
};
|
|
2315
3271
|
|
|
@@ -2320,6 +3276,10 @@ var ScrapeBadger = class {
|
|
|
2320
3276
|
twitter;
|
|
2321
3277
|
/** Web scraping API client */
|
|
2322
3278
|
web;
|
|
3279
|
+
/** Vinted scraper API client */
|
|
3280
|
+
vinted;
|
|
3281
|
+
/** Google Scraper API client — 19 Google product APIs */
|
|
3282
|
+
google;
|
|
2323
3283
|
/**
|
|
2324
3284
|
* Create a new ScrapeBadger client.
|
|
2325
3285
|
*
|
|
@@ -2356,9 +3316,11 @@ var ScrapeBadger = class {
|
|
|
2356
3316
|
this.baseClient = new BaseClient(resolvedConfig);
|
|
2357
3317
|
this.twitter = new TwitterClient(this.baseClient);
|
|
2358
3318
|
this.web = new WebClient(this.baseClient);
|
|
3319
|
+
this.vinted = new VintedClient(this.baseClient);
|
|
3320
|
+
this.google = new GoogleClient(this.baseClient);
|
|
2359
3321
|
}
|
|
2360
3322
|
};
|
|
2361
3323
|
|
|
2362
|
-
export { AccountRestrictedError, AuthenticationError, CommunitiesClient, ConflictError, GeoClient, InsufficientCreditsError, ListsClient, NotFoundError, RateLimitError, ScrapeBadger, ScrapeBadgerError, ServerError, StreamClient, TimeoutError, TrendsClient, TweetsClient, TwitterClient, UsersClient, ValidationError, WebClient, WebSocketStreamError, collectAll, verifyWebhookSignature };
|
|
3324
|
+
export { AccountRestrictedError, AuthenticationError, CommunitiesClient, ConflictError, GeoClient, 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, InsufficientCreditsError, ListsClient, NotFoundError, RateLimitError, ScrapeBadger, ScrapeBadgerError, ServerError, SpacesClient, StreamClient, TimeoutError, TrendsClient, TweetsClient, TwitterClient, UsersClient, ValidationError, VintedClient, ItemsClient as VintedItemsClient, ReferenceClient as VintedReferenceClient, SearchClient as VintedSearchClient, UsersClient2 as VintedUsersClient, WebClient, WebSocketStreamError, collectAll, verifyWebhookSignature };
|
|
2363
3325
|
//# sourceMappingURL=index.mjs.map
|
|
2364
3326
|
//# sourceMappingURL=index.mjs.map
|