scrapebadger 0.46.0 → 0.47.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/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -980,6 +980,8 @@ declare class VintedClient {
|
|
|
980
980
|
listPublicVintedMobileOperations(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
981
981
|
/** Read Vinted mobile data. Generated from the OpenAPI spec; returns the raw response object. */
|
|
982
982
|
readVintedMobileData(operation: string, body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
983
|
+
/** Search by image. Generated from the OpenAPI spec; returns the raw response object. */
|
|
984
|
+
searchByImage(body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
983
985
|
}
|
|
984
986
|
|
|
985
987
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -980,6 +980,8 @@ declare class VintedClient {
|
|
|
980
980
|
listPublicVintedMobileOperations(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
981
981
|
/** Read Vinted mobile data. Generated from the OpenAPI spec; returns the raw response object. */
|
|
982
982
|
readVintedMobileData(operation: string, body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
983
|
+
/** Search by image. Generated from the OpenAPI spec; returns the raw response object. */
|
|
984
|
+
searchByImage(body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
983
985
|
}
|
|
984
986
|
|
|
985
987
|
/**
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
9
9
|
var WebSocket__default = /*#__PURE__*/_interopDefault(WebSocket);
|
|
10
10
|
|
|
11
11
|
// src/internal/version.ts
|
|
12
|
-
var SDK_VERSION = "0.
|
|
12
|
+
var SDK_VERSION = "0.47.1";
|
|
13
13
|
|
|
14
14
|
// src/internal/exceptions.ts
|
|
15
15
|
var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
|
|
@@ -211,8 +211,27 @@ var BaseClient = class _BaseClient {
|
|
|
211
211
|
async executeWithRetry(url, options) {
|
|
212
212
|
let lastError;
|
|
213
213
|
for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
|
|
214
|
+
let retryAfterMs = 0;
|
|
214
215
|
try {
|
|
215
216
|
const httpResponse = await this.fetchWithTimeout(url, options);
|
|
217
|
+
const retryAfter = httpResponse.headers.get("Retry-After")?.trim();
|
|
218
|
+
if (retryAfter) {
|
|
219
|
+
let requestedDelay = 0;
|
|
220
|
+
if (/^\d+$/.test(retryAfter)) {
|
|
221
|
+
requestedDelay = Number(retryAfter) * 1e3;
|
|
222
|
+
} else if (/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} [A-Z][a-z]{2} \d{4}|(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), \d{2}-[A-Z][a-z]{2}-\d{2}) \d{2}:\d{2}:\d{2} GMT$/.test(
|
|
223
|
+
retryAfter
|
|
224
|
+
)) {
|
|
225
|
+
requestedDelay = Date.parse(retryAfter) - Date.now();
|
|
226
|
+
} else if (/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) [A-Z][a-z]{2} [ \d]\d \d{2}:\d{2}:\d{2} \d{4}$/.test(
|
|
227
|
+
retryAfter
|
|
228
|
+
)) {
|
|
229
|
+
requestedDelay = Date.parse(`${retryAfter} GMT`) - Date.now();
|
|
230
|
+
}
|
|
231
|
+
if (requestedDelay > 0 && requestedDelay <= 2147483647) {
|
|
232
|
+
retryAfterMs = requestedDelay;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
216
235
|
const data = await this.handleResponse(httpResponse);
|
|
217
236
|
const rateLimit = this.parseRateLimitHeaders(httpResponse.headers);
|
|
218
237
|
return { data, rateLimit };
|
|
@@ -224,7 +243,7 @@ var BaseClient = class _BaseClient {
|
|
|
224
243
|
if (attempt === this.config.maxRetries) {
|
|
225
244
|
break;
|
|
226
245
|
}
|
|
227
|
-
const delay = this.config.retryDelay * Math.pow(2, attempt);
|
|
246
|
+
const delay = Math.max(this.config.retryDelay * Math.pow(2, attempt), retryAfterMs);
|
|
228
247
|
const delaySec = Math.round(delay / 1e3);
|
|
229
248
|
const attemptNum = attempt + 1;
|
|
230
249
|
const maxRetries = this.config.maxRetries;
|
|
@@ -235,7 +254,7 @@ var BaseClient = class _BaseClient {
|
|
|
235
254
|
if (error.retryAfter) {
|
|
236
255
|
const retryDelay = (error.retryAfter - Date.now() / 1e3) * 1e3;
|
|
237
256
|
if (retryDelay > 0 && retryDelay < 6e4) {
|
|
238
|
-
await this.sleep(retryDelay);
|
|
257
|
+
await this.sleep(Math.max(retryDelay, retryAfterMs));
|
|
239
258
|
continue;
|
|
240
259
|
}
|
|
241
260
|
}
|
|
@@ -2974,6 +2993,10 @@ var VintedClient = class {
|
|
|
2974
2993
|
async readVintedMobileData(operation, body, params = {}) {
|
|
2975
2994
|
return this._gen.request(`/v1/vinted/mobile/${operation}`, { method: "POST", params, body });
|
|
2976
2995
|
}
|
|
2996
|
+
/** Search by image. Generated from the OpenAPI spec; returns the raw response object. */
|
|
2997
|
+
async searchByImage(body, params = {}) {
|
|
2998
|
+
return this._gen.request("/v1/vinted/search_by_image", { method: "POST", params, body });
|
|
2999
|
+
}
|
|
2977
3000
|
// --- END generated by sdk/codegen/facade ---
|
|
2978
3001
|
};
|
|
2979
3002
|
|