ensembledata 0.1.0 → 0.1.4
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 +4 -4
- package/package.json +3 -2
- package/src/client.js +287 -105
- package/src/requester.js +7 -8
- package/src/version.js +1 -1
- package/types/client.d.ts +103 -100
- package/types/client.d.ts.map +1 -1
- package/types/requester.d.ts +5 -5
- package/types/requester.d.ts.map +1 -1
- package/types/version.d.ts +1 -1
package/src/client.js
CHANGED
|
@@ -17,7 +17,7 @@ class CustomerEndpoints {
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @param {{ date: string }} params
|
|
20
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
20
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
21
21
|
* @returns {Promise<EDResponse>}
|
|
22
22
|
*/
|
|
23
23
|
getUsage({ date }, options = {}) {
|
|
@@ -26,13 +26,13 @@ class CustomerEndpoints {
|
|
|
26
26
|
date,
|
|
27
27
|
});
|
|
28
28
|
return this.#requester.get("/customer/get-used-units", params, {
|
|
29
|
-
|
|
29
|
+
timeout: options.timeout,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @param {{ days: number }} params
|
|
35
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
35
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
36
36
|
* @returns {Promise<EDResponse>}
|
|
37
37
|
*/
|
|
38
38
|
getUsageHistory({ days }, options = {}) {
|
|
@@ -41,7 +41,7 @@ class CustomerEndpoints {
|
|
|
41
41
|
days,
|
|
42
42
|
});
|
|
43
43
|
return this.#requester.get("/customer/get-history", params, {
|
|
44
|
-
|
|
44
|
+
timeout: options.timeout,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -60,7 +60,7 @@ class TiktokEndpoints {
|
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* @param {{ hashtag: string; cursor?: number }} params
|
|
63
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
63
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
64
64
|
* @returns {Promise<EDResponse>}
|
|
65
65
|
*/
|
|
66
66
|
hashtagSearch({ hashtag, cursor = undefined }, options = {}) {
|
|
@@ -70,7 +70,7 @@ class TiktokEndpoints {
|
|
|
70
70
|
cursor,
|
|
71
71
|
});
|
|
72
72
|
return this.#requester.get("/tt/hashtag/posts", params, {
|
|
73
|
-
|
|
73
|
+
timeout: options.timeout,
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -81,7 +81,7 @@ class TiktokEndpoints {
|
|
|
81
81
|
* remapOutput?: boolean;
|
|
82
82
|
* maxCursor?: number;
|
|
83
83
|
* }} params
|
|
84
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
84
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
85
85
|
* @returns {Promise<EDResponse>}
|
|
86
86
|
*/
|
|
87
87
|
fullHashtagSearch(
|
|
@@ -96,7 +96,7 @@ class TiktokEndpoints {
|
|
|
96
96
|
max_cursor: maxCursor,
|
|
97
97
|
});
|
|
98
98
|
return this.#requester.get("/tt/hashtag/recent-posts", params, {
|
|
99
|
-
|
|
99
|
+
timeout: options.timeout,
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -110,7 +110,7 @@ class TiktokEndpoints {
|
|
|
110
110
|
* matchExactly?: boolean;
|
|
111
111
|
* getAuthorStats?: boolean;
|
|
112
112
|
* }} params
|
|
113
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
113
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
114
114
|
* @returns {Promise<EDResponse>}
|
|
115
115
|
*/
|
|
116
116
|
keywordSearch(
|
|
@@ -136,7 +136,7 @@ class TiktokEndpoints {
|
|
|
136
136
|
get_author_stats: getAuthorStats,
|
|
137
137
|
});
|
|
138
138
|
return this.#requester.get("/tt/keyword/search", params, {
|
|
139
|
-
|
|
139
|
+
timeout: options.timeout,
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -148,7 +148,7 @@ class TiktokEndpoints {
|
|
|
148
148
|
* country?: string;
|
|
149
149
|
* matchExactly?: boolean;
|
|
150
150
|
* }} params
|
|
151
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
151
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
152
152
|
* @returns {Promise<EDResponse>}
|
|
153
153
|
*/
|
|
154
154
|
fullKeywordSearch(
|
|
@@ -170,7 +170,7 @@ class TiktokEndpoints {
|
|
|
170
170
|
match_exactly: matchExactly,
|
|
171
171
|
});
|
|
172
172
|
return this.#requester.get("/tt/keyword/full-search", params, {
|
|
173
|
-
|
|
173
|
+
timeout: options.timeout,
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
|
|
@@ -182,7 +182,7 @@ class TiktokEndpoints {
|
|
|
182
182
|
* oldestCreatetime?: number;
|
|
183
183
|
* alternativeMethod?: boolean;
|
|
184
184
|
* }} params
|
|
185
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
185
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
186
186
|
* @returns {Promise<EDResponse>}
|
|
187
187
|
*/
|
|
188
188
|
userPostsFromUsername(
|
|
@@ -204,7 +204,7 @@ class TiktokEndpoints {
|
|
|
204
204
|
alternative_method: alternativeMethod,
|
|
205
205
|
});
|
|
206
206
|
return this.#requester.get("/tt/user/posts", params, {
|
|
207
|
-
|
|
207
|
+
timeout: options.timeout,
|
|
208
208
|
returnTopLevelData: true,
|
|
209
209
|
});
|
|
210
210
|
}
|
|
@@ -217,7 +217,7 @@ class TiktokEndpoints {
|
|
|
217
217
|
* oldestCreatetime?: number;
|
|
218
218
|
* alternativeMethod?: boolean;
|
|
219
219
|
* }} params
|
|
220
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
220
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
221
221
|
* @returns {Promise<EDResponse>}
|
|
222
222
|
*/
|
|
223
223
|
userPostsFromSecuid(
|
|
@@ -239,14 +239,14 @@ class TiktokEndpoints {
|
|
|
239
239
|
alternative_method: alternativeMethod,
|
|
240
240
|
});
|
|
241
241
|
return this.#requester.get("/tt/user/posts-from-secuid", params, {
|
|
242
|
-
|
|
242
|
+
timeout: options.timeout,
|
|
243
243
|
returnTopLevelData: true,
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
/**
|
|
248
248
|
* @param {{ username: string }} params
|
|
249
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
249
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
250
250
|
* @returns {Promise<EDResponse>}
|
|
251
251
|
*/
|
|
252
252
|
userInfoFromUsername({ username }, options = {}) {
|
|
@@ -255,13 +255,13 @@ class TiktokEndpoints {
|
|
|
255
255
|
username,
|
|
256
256
|
});
|
|
257
257
|
return this.#requester.get("/tt/user/info", params, {
|
|
258
|
-
|
|
258
|
+
timeout: options.timeout,
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
263
|
* @param {{ secUid: string; alternativeMethod?: boolean }} params
|
|
264
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
264
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
265
265
|
* @returns {Promise<EDResponse>}
|
|
266
266
|
*/
|
|
267
267
|
userInfoFromSecuid(
|
|
@@ -274,13 +274,13 @@ class TiktokEndpoints {
|
|
|
274
274
|
alternative_method: alternativeMethod,
|
|
275
275
|
});
|
|
276
276
|
return this.#requester.get("/tt/user/info-from-secuid", params, {
|
|
277
|
-
|
|
277
|
+
timeout: options.timeout,
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
/**
|
|
282
282
|
* @param {{ keyword: string; cursor?: number }} params
|
|
283
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
283
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
284
284
|
* @returns {Promise<EDResponse>}
|
|
285
285
|
*/
|
|
286
286
|
userSearch({ keyword, cursor = undefined }, options = {}) {
|
|
@@ -290,13 +290,13 @@ class TiktokEndpoints {
|
|
|
290
290
|
cursor,
|
|
291
291
|
});
|
|
292
292
|
return this.#requester.get("/tt/user/search", params, {
|
|
293
|
-
|
|
293
|
+
timeout: options.timeout,
|
|
294
294
|
});
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
298
|
* @param {{ url: string }} params
|
|
299
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
299
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
300
300
|
* @returns {Promise<EDResponse>}
|
|
301
301
|
*/
|
|
302
302
|
postInfo({ url }, options = {}) {
|
|
@@ -305,13 +305,13 @@ class TiktokEndpoints {
|
|
|
305
305
|
url,
|
|
306
306
|
});
|
|
307
307
|
return this.#requester.get("/tt/post/info", params, {
|
|
308
|
-
|
|
308
|
+
timeout: options.timeout,
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
/**
|
|
313
313
|
* @param {{ awemeIds: string[] }} params
|
|
314
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
314
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
315
315
|
* @returns {Promise<EDResponse>}
|
|
316
316
|
*/
|
|
317
317
|
multiPostInfo({ awemeIds }, options = {}) {
|
|
@@ -320,13 +320,13 @@ class TiktokEndpoints {
|
|
|
320
320
|
ids: awemeIds.join(";"),
|
|
321
321
|
});
|
|
322
322
|
return this.#requester.get("/tt/post/multi-info", params, {
|
|
323
|
-
|
|
323
|
+
timeout: options.timeout,
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
/**
|
|
328
328
|
* @param {{ awemeId: string; cursor?: number }} params
|
|
329
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
329
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
330
330
|
* @returns {Promise<EDResponse>}
|
|
331
331
|
*/
|
|
332
332
|
postComments({ awemeId, cursor = undefined }, options = {}) {
|
|
@@ -336,13 +336,13 @@ class TiktokEndpoints {
|
|
|
336
336
|
cursor,
|
|
337
337
|
});
|
|
338
338
|
return this.#requester.get("/tt/post/comments", params, {
|
|
339
|
-
|
|
339
|
+
timeout: options.timeout,
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
/**
|
|
344
344
|
* @param {{ awemeId: string; commentId: string; cursor?: number }} params
|
|
345
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
345
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
346
346
|
* @returns {Promise<EDResponse>}
|
|
347
347
|
*/
|
|
348
348
|
postCommentReplies(
|
|
@@ -356,7 +356,7 @@ class TiktokEndpoints {
|
|
|
356
356
|
cursor,
|
|
357
357
|
});
|
|
358
358
|
return this.#requester.get("/tt/post/comments-replies", params, {
|
|
359
|
-
|
|
359
|
+
timeout: options.timeout,
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
|
|
@@ -367,7 +367,7 @@ class TiktokEndpoints {
|
|
|
367
367
|
* sorting?: "0" | "1" | "2" | "3" | "4";
|
|
368
368
|
* filterBy?: "0" | "1" | "2";
|
|
369
369
|
* }} params
|
|
370
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
370
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
371
371
|
* @returns {Promise<EDResponse>}
|
|
372
372
|
*/
|
|
373
373
|
musicSearch(
|
|
@@ -387,13 +387,13 @@ class TiktokEndpoints {
|
|
|
387
387
|
filter_by: filterBy,
|
|
388
388
|
});
|
|
389
389
|
return this.#requester.get("/tt/music/info", params, {
|
|
390
|
-
|
|
390
|
+
timeout: options.timeout,
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
/**
|
|
395
395
|
* @param {{ musicId: string; cursor?: number }} params
|
|
396
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
396
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
397
397
|
* @returns {Promise<EDResponse>}
|
|
398
398
|
*/
|
|
399
399
|
musicPosts({ musicId, cursor = undefined }, options = {}) {
|
|
@@ -403,13 +403,13 @@ class TiktokEndpoints {
|
|
|
403
403
|
cursor,
|
|
404
404
|
});
|
|
405
405
|
return this.#requester.get("/tt/music/posts", params, {
|
|
406
|
-
|
|
406
|
+
timeout: options.timeout,
|
|
407
407
|
});
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
/**
|
|
411
411
|
* @param {{ musicId: string }} params
|
|
412
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
412
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
413
413
|
* @returns {Promise<EDResponse>}
|
|
414
414
|
*/
|
|
415
415
|
musicDetails({ musicId }, options = {}) {
|
|
@@ -418,13 +418,13 @@ class TiktokEndpoints {
|
|
|
418
418
|
id: musicId,
|
|
419
419
|
});
|
|
420
420
|
return this.#requester.get("/tt/music/details", params, {
|
|
421
|
-
|
|
421
|
+
timeout: options.timeout,
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
/**
|
|
426
426
|
* @param {{ id: string; secUid: string; cursor?: number }} params
|
|
427
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
427
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
428
428
|
* @returns {Promise<EDResponse>}
|
|
429
429
|
*/
|
|
430
430
|
userFollowers({ id, secUid, cursor = undefined }, options = {}) {
|
|
@@ -435,7 +435,7 @@ class TiktokEndpoints {
|
|
|
435
435
|
cursor,
|
|
436
436
|
});
|
|
437
437
|
return this.#requester.get("/tt/user/followers", params, {
|
|
438
|
-
|
|
438
|
+
timeout: options.timeout,
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
|
|
@@ -446,7 +446,7 @@ class TiktokEndpoints {
|
|
|
446
446
|
* cursor?: number;
|
|
447
447
|
* pageToken?: string;
|
|
448
448
|
* }} params
|
|
449
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
449
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
450
450
|
* @returns {Promise<EDResponse>}
|
|
451
451
|
*/
|
|
452
452
|
userFollowings(
|
|
@@ -461,13 +461,13 @@ class TiktokEndpoints {
|
|
|
461
461
|
page_token: pageToken,
|
|
462
462
|
});
|
|
463
463
|
return this.#requester.get("/tt/user/followings", params, {
|
|
464
|
-
|
|
464
|
+
timeout: options.timeout,
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
/**
|
|
469
469
|
* @param {{ secUid: string; cursor?: number }} params
|
|
470
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
470
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
471
471
|
* @returns {Promise<EDResponse>}
|
|
472
472
|
*/
|
|
473
473
|
userLikedPosts({ secUid, cursor = undefined }, options = {}) {
|
|
@@ -477,7 +477,7 @@ class TiktokEndpoints {
|
|
|
477
477
|
cursor,
|
|
478
478
|
});
|
|
479
479
|
return this.#requester.get("/tt/user/liked-posts", params, {
|
|
480
|
-
|
|
480
|
+
timeout: options.timeout,
|
|
481
481
|
});
|
|
482
482
|
}
|
|
483
483
|
}
|
|
@@ -503,7 +503,7 @@ class YoutubeEndpoints {
|
|
|
503
503
|
* sorting?: "relevance" | "time" | "views" | "rating";
|
|
504
504
|
* getAdditionalInfo?: boolean;
|
|
505
505
|
* }} params
|
|
506
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
506
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
507
507
|
* @returns {Promise<EDResponse>}
|
|
508
508
|
*/
|
|
509
509
|
keywordSearch(
|
|
@@ -527,13 +527,13 @@ class YoutubeEndpoints {
|
|
|
527
527
|
get_additional_info: getAdditionalInfo,
|
|
528
528
|
});
|
|
529
529
|
return this.#requester.get("/youtube/search", params, {
|
|
530
|
-
|
|
530
|
+
timeout: options.timeout,
|
|
531
531
|
});
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
/**
|
|
535
535
|
* @param {{ keyword: string }} params
|
|
536
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
536
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
537
537
|
* @returns {Promise<EDResponse>}
|
|
538
538
|
*/
|
|
539
539
|
featuredCategoriesSearch({ keyword }, options = {}) {
|
|
@@ -544,13 +544,13 @@ class YoutubeEndpoints {
|
|
|
544
544
|
return this.#requester.get(
|
|
545
545
|
"/youtube/search/featured-categories",
|
|
546
546
|
params,
|
|
547
|
-
{
|
|
547
|
+
{ timeout: options.timeout },
|
|
548
548
|
);
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
/**
|
|
552
552
|
* @param {{ hashtag: string; depth: number; onlyShorts?: boolean }} params
|
|
553
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
553
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
554
554
|
* @returns {Promise<EDResponse>}
|
|
555
555
|
*/
|
|
556
556
|
hashtagSearch({ hashtag, depth, onlyShorts = undefined }, options = {}) {
|
|
@@ -561,13 +561,13 @@ class YoutubeEndpoints {
|
|
|
561
561
|
only_shorts: onlyShorts,
|
|
562
562
|
});
|
|
563
563
|
return this.#requester.get("/youtube/hashtag/search", params, {
|
|
564
|
-
|
|
564
|
+
timeout: options.timeout,
|
|
565
565
|
});
|
|
566
566
|
}
|
|
567
567
|
|
|
568
568
|
/**
|
|
569
569
|
* @param {{ channelId: string; fromUrl?: boolean }} params
|
|
570
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
570
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
571
571
|
* @returns {Promise<EDResponse>}
|
|
572
572
|
*/
|
|
573
573
|
channelDetailedInfo({ channelId, fromUrl = undefined }, options = {}) {
|
|
@@ -577,13 +577,13 @@ class YoutubeEndpoints {
|
|
|
577
577
|
from_url: fromUrl,
|
|
578
578
|
});
|
|
579
579
|
return this.#requester.get("/youtube/channel/detailed-info", params, {
|
|
580
|
-
|
|
580
|
+
timeout: options.timeout,
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
|
|
584
584
|
/**
|
|
585
585
|
* @param {{ channelId: string; depth: number }} params
|
|
586
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
586
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
587
587
|
* @returns {Promise<EDResponse>}
|
|
588
588
|
*/
|
|
589
589
|
channelVideos({ channelId, depth }, options = {}) {
|
|
@@ -593,13 +593,13 @@ class YoutubeEndpoints {
|
|
|
593
593
|
depth,
|
|
594
594
|
});
|
|
595
595
|
return this.#requester.get("/youtube/channel/videos", params, {
|
|
596
|
-
|
|
596
|
+
timeout: options.timeout,
|
|
597
597
|
});
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
/**
|
|
601
601
|
* @param {{ channelId: string; depth: number }} params
|
|
602
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
602
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
603
603
|
* @returns {Promise<EDResponse>}
|
|
604
604
|
*/
|
|
605
605
|
channelShorts({ channelId, depth }, options = {}) {
|
|
@@ -609,7 +609,7 @@ class YoutubeEndpoints {
|
|
|
609
609
|
depth,
|
|
610
610
|
});
|
|
611
611
|
return this.#requester.get("/youtube/channel/shorts", params, {
|
|
612
|
-
|
|
612
|
+
timeout: options.timeout,
|
|
613
613
|
});
|
|
614
614
|
}
|
|
615
615
|
|
|
@@ -619,7 +619,7 @@ class YoutubeEndpoints {
|
|
|
619
619
|
* alternativeMethod?: boolean;
|
|
620
620
|
* getSubscribersCount?: boolean;
|
|
621
621
|
* }} params
|
|
622
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
622
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
623
623
|
* @returns {Promise<EDResponse>}
|
|
624
624
|
*/
|
|
625
625
|
videoDetails(
|
|
@@ -633,13 +633,13 @@ class YoutubeEndpoints {
|
|
|
633
633
|
get_subscribers_count: getSubscribersCount,
|
|
634
634
|
});
|
|
635
635
|
return this.#requester.get("/youtube/channel/get-short-stats", params, {
|
|
636
|
-
|
|
636
|
+
timeout: options.timeout,
|
|
637
637
|
});
|
|
638
638
|
}
|
|
639
639
|
|
|
640
640
|
/**
|
|
641
641
|
* @param {{ channelId: string }} params
|
|
642
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
642
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
643
643
|
* @returns {Promise<EDResponse>}
|
|
644
644
|
*/
|
|
645
645
|
channelSubscribers({ channelId }, options = {}) {
|
|
@@ -648,13 +648,13 @@ class YoutubeEndpoints {
|
|
|
648
648
|
browseId: channelId,
|
|
649
649
|
});
|
|
650
650
|
return this.#requester.get("/youtube/channel/followers", params, {
|
|
651
|
-
|
|
651
|
+
timeout: options.timeout,
|
|
652
652
|
});
|
|
653
653
|
}
|
|
654
654
|
|
|
655
655
|
/**
|
|
656
656
|
* @param {{ username: string }} params
|
|
657
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
657
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
658
658
|
* @returns {Promise<EDResponse>}
|
|
659
659
|
*/
|
|
660
660
|
channelUsernameToId({ username }, options = {}) {
|
|
@@ -663,13 +663,13 @@ class YoutubeEndpoints {
|
|
|
663
663
|
name: username,
|
|
664
664
|
});
|
|
665
665
|
return this.#requester.get("/youtube/channel/name-to-id", params, {
|
|
666
|
-
|
|
666
|
+
timeout: options.timeout,
|
|
667
667
|
});
|
|
668
668
|
}
|
|
669
669
|
|
|
670
670
|
/**
|
|
671
671
|
* @param {{ channelId: string }} params
|
|
672
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
672
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
673
673
|
* @returns {Promise<EDResponse>}
|
|
674
674
|
*/
|
|
675
675
|
channelIdToUsername({ channelId }, options = {}) {
|
|
@@ -678,13 +678,13 @@ class YoutubeEndpoints {
|
|
|
678
678
|
browseId: channelId,
|
|
679
679
|
});
|
|
680
680
|
return this.#requester.get("/youtube/channel/id-to-name", params, {
|
|
681
|
-
|
|
681
|
+
timeout: options.timeout,
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
/**
|
|
686
686
|
* @param {{ musicId: string; depth?: number }} params
|
|
687
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
687
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
688
688
|
* @returns {Promise<EDResponse>}
|
|
689
689
|
*/
|
|
690
690
|
musicIdToShorts({ musicId, depth = undefined }, options = {}) {
|
|
@@ -694,13 +694,13 @@ class YoutubeEndpoints {
|
|
|
694
694
|
depth,
|
|
695
695
|
});
|
|
696
696
|
return this.#requester.get("/youtube/music/id-to-shorts", params, {
|
|
697
|
-
|
|
697
|
+
timeout: options.timeout,
|
|
698
698
|
});
|
|
699
699
|
}
|
|
700
700
|
|
|
701
701
|
/**
|
|
702
702
|
* @param {{ id: string; cursor?: string }} params
|
|
703
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
703
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
704
704
|
* @returns {Promise<EDResponse>}
|
|
705
705
|
*/
|
|
706
706
|
videoComments({ id, cursor = undefined }, options = {}) {
|
|
@@ -710,7 +710,7 @@ class YoutubeEndpoints {
|
|
|
710
710
|
cursor,
|
|
711
711
|
});
|
|
712
712
|
return this.#requester.get("/youtube/video/comments", params, {
|
|
713
|
-
|
|
713
|
+
timeout: options.timeout,
|
|
714
714
|
});
|
|
715
715
|
}
|
|
716
716
|
}
|
|
@@ -736,7 +736,7 @@ class InstagramEndpoints {
|
|
|
736
736
|
* cursor?: string;
|
|
737
737
|
* alternativeMethod?: boolean;
|
|
738
738
|
* }} params
|
|
739
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
739
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
740
740
|
* @returns {Promise<EDResponse>}
|
|
741
741
|
*/
|
|
742
742
|
userPosts(
|
|
@@ -760,13 +760,13 @@ class InstagramEndpoints {
|
|
|
760
760
|
alternative_method: alternativeMethod,
|
|
761
761
|
});
|
|
762
762
|
return this.#requester.get("/instagram/user/posts", params, {
|
|
763
|
-
|
|
763
|
+
timeout: options.timeout,
|
|
764
764
|
});
|
|
765
765
|
}
|
|
766
766
|
|
|
767
767
|
/**
|
|
768
768
|
* @param {{ userId: number }} params
|
|
769
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
769
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
770
770
|
* @returns {Promise<EDResponse>}
|
|
771
771
|
*/
|
|
772
772
|
userBasicStats({ userId }, options = {}) {
|
|
@@ -775,13 +775,13 @@ class InstagramEndpoints {
|
|
|
775
775
|
user_id: userId,
|
|
776
776
|
});
|
|
777
777
|
return this.#requester.get("/instagram/user/basic-info", params, {
|
|
778
|
-
|
|
778
|
+
timeout: options.timeout,
|
|
779
779
|
});
|
|
780
780
|
}
|
|
781
781
|
|
|
782
782
|
/**
|
|
783
783
|
* @param {{ username: string }} params
|
|
784
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
784
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
785
785
|
* @returns {Promise<EDResponse>}
|
|
786
786
|
*/
|
|
787
787
|
userInfo({ username }, options = {}) {
|
|
@@ -790,13 +790,13 @@ class InstagramEndpoints {
|
|
|
790
790
|
username,
|
|
791
791
|
});
|
|
792
792
|
return this.#requester.get("/instagram/user/info", params, {
|
|
793
|
-
|
|
793
|
+
timeout: options.timeout,
|
|
794
794
|
});
|
|
795
795
|
}
|
|
796
796
|
|
|
797
797
|
/**
|
|
798
798
|
* @param {{ username: string }} params
|
|
799
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
799
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
800
800
|
* @returns {Promise<EDResponse>}
|
|
801
801
|
*/
|
|
802
802
|
userDetailedInfo({ username }, options = {}) {
|
|
@@ -805,13 +805,13 @@ class InstagramEndpoints {
|
|
|
805
805
|
username,
|
|
806
806
|
});
|
|
807
807
|
return this.#requester.get("/instagram/user/detailed-info", params, {
|
|
808
|
-
|
|
808
|
+
timeout: options.timeout,
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
811
|
|
|
812
812
|
/**
|
|
813
813
|
* @param {{ userId: number }} params
|
|
814
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
814
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
815
815
|
* @returns {Promise<EDResponse>}
|
|
816
816
|
*/
|
|
817
817
|
userFollowers({ userId }, options = {}) {
|
|
@@ -820,7 +820,7 @@ class InstagramEndpoints {
|
|
|
820
820
|
user_id: userId,
|
|
821
821
|
});
|
|
822
822
|
return this.#requester.get("/instagram/user/followers", params, {
|
|
823
|
-
|
|
823
|
+
timeout: options.timeout,
|
|
824
824
|
});
|
|
825
825
|
}
|
|
826
826
|
|
|
@@ -833,7 +833,7 @@ class InstagramEndpoints {
|
|
|
833
833
|
* cursor?: string;
|
|
834
834
|
* chunkSize?: number;
|
|
835
835
|
* }} params
|
|
836
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
836
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
837
837
|
* @returns {Promise<EDResponse>}
|
|
838
838
|
*/
|
|
839
839
|
userReels(
|
|
@@ -857,13 +857,13 @@ class InstagramEndpoints {
|
|
|
857
857
|
chunk_size: chunkSize,
|
|
858
858
|
});
|
|
859
859
|
return this.#requester.get("/instagram/user/reels", params, {
|
|
860
|
-
|
|
860
|
+
timeout: options.timeout,
|
|
861
861
|
});
|
|
862
862
|
}
|
|
863
863
|
|
|
864
864
|
/**
|
|
865
865
|
* @param {{ userId: number; cursor?: string; chunkSize?: number }} params
|
|
866
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
866
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
867
867
|
* @returns {Promise<EDResponse>}
|
|
868
868
|
*/
|
|
869
869
|
userTaggedPosts(
|
|
@@ -877,13 +877,13 @@ class InstagramEndpoints {
|
|
|
877
877
|
chunk_size: chunkSize,
|
|
878
878
|
});
|
|
879
879
|
return this.#requester.get("/instagram/user/tagged-posts", params, {
|
|
880
|
-
|
|
880
|
+
timeout: options.timeout,
|
|
881
881
|
});
|
|
882
882
|
}
|
|
883
883
|
|
|
884
884
|
/**
|
|
885
885
|
* @param {{ code: string; numComments?: number }} params
|
|
886
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
886
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
887
887
|
* @returns {Promise<EDResponse>}
|
|
888
888
|
*/
|
|
889
889
|
postInfoAndComments({ code, numComments = undefined }, options = {}) {
|
|
@@ -893,7 +893,7 @@ class InstagramEndpoints {
|
|
|
893
893
|
n_comments_to_fetch: numComments,
|
|
894
894
|
});
|
|
895
895
|
return this.#requester.get("/instagram/post/details", params, {
|
|
896
|
-
|
|
896
|
+
timeout: options.timeout,
|
|
897
897
|
});
|
|
898
898
|
}
|
|
899
899
|
|
|
@@ -905,7 +905,7 @@ class InstagramEndpoints {
|
|
|
905
905
|
* getAuthorInfo?: boolean;
|
|
906
906
|
* alternativeMethod?: boolean;
|
|
907
907
|
* }} params
|
|
908
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
908
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
909
909
|
* @returns {Promise<EDResponse>}
|
|
910
910
|
*/
|
|
911
911
|
hashtagPosts(
|
|
@@ -927,13 +927,13 @@ class InstagramEndpoints {
|
|
|
927
927
|
alternative_method: alternativeMethod,
|
|
928
928
|
});
|
|
929
929
|
return this.#requester.get("/instagram/hashtag/posts", params, {
|
|
930
|
-
|
|
930
|
+
timeout: options.timeout,
|
|
931
931
|
});
|
|
932
932
|
}
|
|
933
933
|
|
|
934
934
|
/**
|
|
935
935
|
* @param {{ musicId: string; cursor?: string }} params
|
|
936
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
936
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
937
937
|
* @returns {Promise<EDResponse>}
|
|
938
938
|
*/
|
|
939
939
|
musicPosts({ musicId, cursor = undefined }, options = {}) {
|
|
@@ -943,13 +943,13 @@ class InstagramEndpoints {
|
|
|
943
943
|
cursor,
|
|
944
944
|
});
|
|
945
945
|
return this.#requester.get("/instagram/music/posts", params, {
|
|
946
|
-
|
|
946
|
+
timeout: options.timeout,
|
|
947
947
|
});
|
|
948
948
|
}
|
|
949
949
|
|
|
950
950
|
/**
|
|
951
951
|
* @param {{ text: string }} params
|
|
952
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
952
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
953
953
|
* @returns {Promise<EDResponse>}
|
|
954
954
|
*/
|
|
955
955
|
search({ text }, options = {}) {
|
|
@@ -958,7 +958,7 @@ class InstagramEndpoints {
|
|
|
958
958
|
text,
|
|
959
959
|
});
|
|
960
960
|
return this.#requester.get("/instagram/search", params, {
|
|
961
|
-
|
|
961
|
+
timeout: options.timeout,
|
|
962
962
|
});
|
|
963
963
|
}
|
|
964
964
|
}
|
|
@@ -981,7 +981,7 @@ class TwitchEndpoints {
|
|
|
981
981
|
* depth: number;
|
|
982
982
|
* type: "videos" | "channels" | "games";
|
|
983
983
|
* }} params
|
|
984
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
984
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
985
985
|
* @returns {Promise<EDResponse>}
|
|
986
986
|
*/
|
|
987
987
|
keywordSearch({ keyword, depth, type }, options = {}) {
|
|
@@ -992,13 +992,13 @@ class TwitchEndpoints {
|
|
|
992
992
|
type,
|
|
993
993
|
});
|
|
994
994
|
return this.#requester.get("/twitch/search", params, {
|
|
995
|
-
|
|
995
|
+
timeout: options.timeout,
|
|
996
996
|
});
|
|
997
997
|
}
|
|
998
998
|
|
|
999
999
|
/**
|
|
1000
1000
|
* @param {{ username: string }} params
|
|
1001
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
1001
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1002
1002
|
* @returns {Promise<EDResponse>}
|
|
1003
1003
|
*/
|
|
1004
1004
|
userFollowers({ username }, options = {}) {
|
|
@@ -1007,7 +1007,7 @@ class TwitchEndpoints {
|
|
|
1007
1007
|
username,
|
|
1008
1008
|
});
|
|
1009
1009
|
return this.#requester.get("/twitch/user/followers", params, {
|
|
1010
|
-
|
|
1010
|
+
timeout: options.timeout,
|
|
1011
1011
|
});
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
@@ -1031,7 +1031,7 @@ class RedditEndpoints {
|
|
|
1031
1031
|
* period: "hour" | "day" | "week" | "month" | "year" | "all";
|
|
1032
1032
|
* cursor?: string;
|
|
1033
1033
|
* }} params
|
|
1034
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
1034
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1035
1035
|
* @returns {Promise<EDResponse>}
|
|
1036
1036
|
*/
|
|
1037
1037
|
subredditPosts({ name, sort, period, cursor = undefined }, options = {}) {
|
|
@@ -1043,13 +1043,13 @@ class RedditEndpoints {
|
|
|
1043
1043
|
cursor,
|
|
1044
1044
|
});
|
|
1045
1045
|
return this.#requester.get("/reddit/subreddit/posts", params, {
|
|
1046
|
-
|
|
1046
|
+
timeout: options.timeout,
|
|
1047
1047
|
});
|
|
1048
1048
|
}
|
|
1049
1049
|
|
|
1050
1050
|
/**
|
|
1051
1051
|
* @param {{ id: string; cursor?: string }} params
|
|
1052
|
-
* @param {{ extraParams?: Record<string, any>;
|
|
1052
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1053
1053
|
* @returns {Promise<EDResponse>}
|
|
1054
1054
|
*/
|
|
1055
1055
|
postComments({ id, cursor = undefined }, options = {}) {
|
|
@@ -1059,7 +1059,183 @@ class RedditEndpoints {
|
|
|
1059
1059
|
cursor,
|
|
1060
1060
|
});
|
|
1061
1061
|
return this.#requester.get("/reddit/post/comments", params, {
|
|
1062
|
-
|
|
1062
|
+
timeout: options.timeout,
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
class TwitterEndpoints {
|
|
1068
|
+
/**
|
|
1069
|
+
* @type {Requester}
|
|
1070
|
+
* @readonly
|
|
1071
|
+
*/
|
|
1072
|
+
#requester;
|
|
1073
|
+
|
|
1074
|
+
/** @param {{ requester: Requester }} options */
|
|
1075
|
+
constructor({ requester }) {
|
|
1076
|
+
this.#requester = requester;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* @param {{ name: string }} params
|
|
1081
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1082
|
+
* @returns {Promise<EDResponse>}
|
|
1083
|
+
*/
|
|
1084
|
+
userInfo({ name }, options = {}) {
|
|
1085
|
+
const params = filterUndefinedValues({
|
|
1086
|
+
...options.extraParams,
|
|
1087
|
+
name,
|
|
1088
|
+
});
|
|
1089
|
+
return this.#requester.get("/twitter/user/info", params, {
|
|
1090
|
+
timeout: options.timeout,
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* @param {{ id: number }} params
|
|
1096
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1097
|
+
* @returns {Promise<EDResponse>}
|
|
1098
|
+
*/
|
|
1099
|
+
userTweets({ id }, options = {}) {
|
|
1100
|
+
const params = filterUndefinedValues({
|
|
1101
|
+
...options.extraParams,
|
|
1102
|
+
id,
|
|
1103
|
+
});
|
|
1104
|
+
return this.#requester.get("/twitter/user/tweets", params, {
|
|
1105
|
+
timeout: options.timeout,
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* @param {{ id: number }} params
|
|
1111
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1112
|
+
* @returns {Promise<EDResponse>}
|
|
1113
|
+
*/
|
|
1114
|
+
postInfo({ id }, options = {}) {
|
|
1115
|
+
const params = filterUndefinedValues({
|
|
1116
|
+
...options.extraParams,
|
|
1117
|
+
id,
|
|
1118
|
+
});
|
|
1119
|
+
return this.#requester.get("/twitter/post/info", params, {
|
|
1120
|
+
timeout: options.timeout,
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
class ThreadsEndpoints {
|
|
1126
|
+
/**
|
|
1127
|
+
* @type {Requester}
|
|
1128
|
+
* @readonly
|
|
1129
|
+
*/
|
|
1130
|
+
#requester;
|
|
1131
|
+
|
|
1132
|
+
/** @param {{ requester: Requester }} options */
|
|
1133
|
+
constructor({ requester }) {
|
|
1134
|
+
this.#requester = requester;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* @param {{ name: string; sorting?: "0" | "1" }} params
|
|
1139
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1140
|
+
* @returns {Promise<EDResponse>}
|
|
1141
|
+
*/
|
|
1142
|
+
searchKeyword({ name, sorting = undefined }, options = {}) {
|
|
1143
|
+
const params = filterUndefinedValues({
|
|
1144
|
+
...options.extraParams,
|
|
1145
|
+
name,
|
|
1146
|
+
sorting,
|
|
1147
|
+
});
|
|
1148
|
+
return this.#requester.get("/threads/keyword/search", params, {
|
|
1149
|
+
timeout: options.timeout,
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* @param {{ name: string }} params
|
|
1155
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1156
|
+
* @returns {Promise<EDResponse>}
|
|
1157
|
+
*/
|
|
1158
|
+
userSearch({ name }, options = {}) {
|
|
1159
|
+
const params = filterUndefinedValues({
|
|
1160
|
+
...options.extraParams,
|
|
1161
|
+
name,
|
|
1162
|
+
});
|
|
1163
|
+
return this.#requester.get("/threads/user/search", params, {
|
|
1164
|
+
timeout: options.timeout,
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* @param {{ id: number }} params
|
|
1170
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1171
|
+
* @returns {Promise<EDResponse>}
|
|
1172
|
+
*/
|
|
1173
|
+
userInfo({ id }, options = {}) {
|
|
1174
|
+
const params = filterUndefinedValues({
|
|
1175
|
+
...options.extraParams,
|
|
1176
|
+
id,
|
|
1177
|
+
});
|
|
1178
|
+
return this.#requester.get("/threads/user/info", params, {
|
|
1179
|
+
timeout: options.timeout,
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* @param {{ id: number; chunkSize?: number }} params
|
|
1185
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1186
|
+
* @returns {Promise<EDResponse>}
|
|
1187
|
+
*/
|
|
1188
|
+
userPosts({ id, chunkSize = undefined }, options = {}) {
|
|
1189
|
+
const params = filterUndefinedValues({
|
|
1190
|
+
...options.extraParams,
|
|
1191
|
+
id,
|
|
1192
|
+
chunk_size: chunkSize,
|
|
1193
|
+
});
|
|
1194
|
+
return this.#requester.get("/threads/user/posts", params, {
|
|
1195
|
+
timeout: options.timeout,
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* @param {{ id: number }} params
|
|
1201
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1202
|
+
* @returns {Promise<EDResponse>}
|
|
1203
|
+
*/
|
|
1204
|
+
postReplies({ id }, options = {}) {
|
|
1205
|
+
const params = filterUndefinedValues({
|
|
1206
|
+
...options.extraParams,
|
|
1207
|
+
id,
|
|
1208
|
+
});
|
|
1209
|
+
return this.#requester.get("/threads/post/replies", params, {
|
|
1210
|
+
timeout: options.timeout,
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
class SnapchatEndpoints {
|
|
1216
|
+
/**
|
|
1217
|
+
* @type {Requester}
|
|
1218
|
+
* @readonly
|
|
1219
|
+
*/
|
|
1220
|
+
#requester;
|
|
1221
|
+
|
|
1222
|
+
/** @param {{ requester: Requester }} options */
|
|
1223
|
+
constructor({ requester }) {
|
|
1224
|
+
this.#requester = requester;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* @param {{ name: string }} params
|
|
1229
|
+
* @param {{ extraParams?: Record<string, any>; timeout?: number }} options
|
|
1230
|
+
* @returns {Promise<EDResponse>}
|
|
1231
|
+
*/
|
|
1232
|
+
userInfo({ name }, options = {}) {
|
|
1233
|
+
const params = filterUndefinedValues({
|
|
1234
|
+
...options.extraParams,
|
|
1235
|
+
name,
|
|
1236
|
+
});
|
|
1237
|
+
return this.#requester.get("/snapchat/user/info", params, {
|
|
1238
|
+
timeout: options.timeout,
|
|
1063
1239
|
});
|
|
1064
1240
|
}
|
|
1065
1241
|
}
|
|
@@ -1074,16 +1250,12 @@ export class EDClient {
|
|
|
1074
1250
|
/**
|
|
1075
1251
|
* @param {{
|
|
1076
1252
|
* token: string;
|
|
1077
|
-
*
|
|
1253
|
+
* timeout?: number;
|
|
1078
1254
|
* maxNetworkRetries?: number;
|
|
1079
1255
|
* }} options
|
|
1080
1256
|
*/
|
|
1081
|
-
constructor({ token,
|
|
1082
|
-
const requester = new Requester({
|
|
1083
|
-
token,
|
|
1084
|
-
timeoutSecs,
|
|
1085
|
-
maxNetworkRetries,
|
|
1086
|
-
});
|
|
1257
|
+
constructor({ token, timeout = 600, maxNetworkRetries = 3 }) {
|
|
1258
|
+
const requester = new Requester({ token, timeout, maxNetworkRetries });
|
|
1087
1259
|
this.#requester = requester;
|
|
1088
1260
|
|
|
1089
1261
|
/** @readonly */
|
|
@@ -1103,14 +1275,24 @@ export class EDClient {
|
|
|
1103
1275
|
|
|
1104
1276
|
/** @readonly */
|
|
1105
1277
|
this.reddit = new RedditEndpoints({ requester });
|
|
1278
|
+
|
|
1279
|
+
/** @readonly */
|
|
1280
|
+
this.twitter = new TwitterEndpoints({ requester });
|
|
1281
|
+
|
|
1282
|
+
/** @readonly */
|
|
1283
|
+
this.threads = new ThreadsEndpoints({ requester });
|
|
1284
|
+
|
|
1285
|
+
/** @readonly */
|
|
1286
|
+
this.snapchat = new SnapchatEndpoints({ requester });
|
|
1106
1287
|
}
|
|
1107
1288
|
|
|
1108
1289
|
/**
|
|
1109
1290
|
* @param {string} path
|
|
1110
1291
|
* @param {Record<string, string>} params
|
|
1292
|
+
* @param {{ timeout?: number }} options
|
|
1111
1293
|
* @returns {Promise<EDResponse>}
|
|
1112
1294
|
*/
|
|
1113
|
-
async request(path, params) {
|
|
1114
|
-
return this.#requester.get(path, params);
|
|
1295
|
+
async request(path, params, options = {}) {
|
|
1296
|
+
return this.#requester.get(path, params, { timeout: options.timeout });
|
|
1115
1297
|
}
|
|
1116
1298
|
}
|