@bycrawl/nodejs-sdk 0.1.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/LICENSE +21 -0
- package/dist/index.cjs +1027 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +803 -0
- package/dist/index.d.ts +803 -0
- package/dist/index.js +990 -0
- package/dist/index.js.map +1 -0
- package/package.json +65 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
declare const SDK_VERSION = "0.1.1";
|
|
2
|
+
interface ResponseWrapper {
|
|
3
|
+
statusCode: number;
|
|
4
|
+
data: Record<string, unknown>;
|
|
5
|
+
headers: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
interface TransportOptions {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
maxRetries?: number;
|
|
12
|
+
}
|
|
13
|
+
declare class Transport {
|
|
14
|
+
private readonly apiKey;
|
|
15
|
+
private readonly baseUrl;
|
|
16
|
+
private readonly timeout;
|
|
17
|
+
private readonly maxRetries;
|
|
18
|
+
private readonly defaultHeaders;
|
|
19
|
+
constructor(options: TransportOptions);
|
|
20
|
+
request(method: string, path: string, options?: {
|
|
21
|
+
params?: Record<string, unknown>;
|
|
22
|
+
json?: Record<string, unknown>;
|
|
23
|
+
headers?: Record<string, string>;
|
|
24
|
+
}): Promise<ResponseWrapper>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* ByCrawl Response Types
|
|
29
|
+
*
|
|
30
|
+
* TypeScript interfaces for all API responses.
|
|
31
|
+
* All fields from the API are preserved — extra fields are allowed via index signatures.
|
|
32
|
+
*/
|
|
33
|
+
interface RateLimit {
|
|
34
|
+
limit: number | null;
|
|
35
|
+
remaining: number | null;
|
|
36
|
+
reset: number | null;
|
|
37
|
+
}
|
|
38
|
+
interface CreditInfo {
|
|
39
|
+
remaining: number | null;
|
|
40
|
+
used: number | null;
|
|
41
|
+
}
|
|
42
|
+
interface APIResponse<T> {
|
|
43
|
+
success: boolean;
|
|
44
|
+
data: T | null;
|
|
45
|
+
error: string | null;
|
|
46
|
+
queued: boolean;
|
|
47
|
+
rateLimit: RateLimit | null;
|
|
48
|
+
credit: CreditInfo | null;
|
|
49
|
+
}
|
|
50
|
+
interface PaginatedData<T> {
|
|
51
|
+
items: T[];
|
|
52
|
+
nextCursor: string | null;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
interface ThreadsUser {
|
|
56
|
+
id: string;
|
|
57
|
+
username: string;
|
|
58
|
+
fullName?: string | null;
|
|
59
|
+
profilePic?: string | null;
|
|
60
|
+
bio?: string | null;
|
|
61
|
+
isVerified?: boolean;
|
|
62
|
+
followerCount?: number | null;
|
|
63
|
+
followingCount?: number | null;
|
|
64
|
+
[key: string]: unknown;
|
|
65
|
+
}
|
|
66
|
+
interface ThreadsPostStats {
|
|
67
|
+
likes?: number;
|
|
68
|
+
replies?: number;
|
|
69
|
+
quotes?: number;
|
|
70
|
+
reposts?: number;
|
|
71
|
+
shares?: number;
|
|
72
|
+
[key: string]: unknown;
|
|
73
|
+
}
|
|
74
|
+
interface ThreadsMedia {
|
|
75
|
+
index?: number;
|
|
76
|
+
type?: string;
|
|
77
|
+
url?: string;
|
|
78
|
+
width?: number | null;
|
|
79
|
+
height?: number | null;
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
}
|
|
82
|
+
interface ThreadsPost {
|
|
83
|
+
id: string;
|
|
84
|
+
code?: string | null;
|
|
85
|
+
text?: string | null;
|
|
86
|
+
user?: ThreadsUser | null;
|
|
87
|
+
media?: ThreadsMedia[];
|
|
88
|
+
stats?: ThreadsPostStats | null;
|
|
89
|
+
createdAt?: string | null;
|
|
90
|
+
views?: number | null;
|
|
91
|
+
isReply?: boolean;
|
|
92
|
+
replyTo?: unknown;
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
}
|
|
95
|
+
interface FacebookUser {
|
|
96
|
+
id?: string | null;
|
|
97
|
+
name?: string | null;
|
|
98
|
+
username?: string | null;
|
|
99
|
+
category?: string | null;
|
|
100
|
+
profilePicture?: string | null;
|
|
101
|
+
coverPhoto?: string | null;
|
|
102
|
+
likesCount?: number | null;
|
|
103
|
+
description?: string | null;
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
}
|
|
106
|
+
interface FacebookPost {
|
|
107
|
+
id?: string | null;
|
|
108
|
+
url?: string | null;
|
|
109
|
+
text?: string | null;
|
|
110
|
+
createdAt?: string | null;
|
|
111
|
+
reactionCount?: number | null;
|
|
112
|
+
commentCount?: number | null;
|
|
113
|
+
shareCount?: number | null;
|
|
114
|
+
viewCount?: number | null;
|
|
115
|
+
media?: Record<string, unknown>[];
|
|
116
|
+
[key: string]: unknown;
|
|
117
|
+
}
|
|
118
|
+
interface XUser {
|
|
119
|
+
id: string;
|
|
120
|
+
username: string;
|
|
121
|
+
name?: string | null;
|
|
122
|
+
description?: string | null;
|
|
123
|
+
profileImageUrl?: string | null;
|
|
124
|
+
bannerUrl?: string | null;
|
|
125
|
+
followersCount?: number | null;
|
|
126
|
+
followingCount?: number | null;
|
|
127
|
+
tweetCount?: number | null;
|
|
128
|
+
isVerified?: boolean;
|
|
129
|
+
isBlueVerified?: boolean;
|
|
130
|
+
createdAt?: string | null;
|
|
131
|
+
location?: string | null;
|
|
132
|
+
url?: string | null;
|
|
133
|
+
[key: string]: unknown;
|
|
134
|
+
}
|
|
135
|
+
interface XPost {
|
|
136
|
+
id: string;
|
|
137
|
+
text?: string | null;
|
|
138
|
+
createdAt?: string | null;
|
|
139
|
+
user?: XUser | null;
|
|
140
|
+
likeCount?: number | null;
|
|
141
|
+
retweetCount?: number | null;
|
|
142
|
+
replyCount?: number | null;
|
|
143
|
+
quoteCount?: number | null;
|
|
144
|
+
bookmarkCount?: number | null;
|
|
145
|
+
viewCount?: number | null;
|
|
146
|
+
media?: Record<string, unknown>[];
|
|
147
|
+
isRetweet?: boolean;
|
|
148
|
+
isReply?: boolean;
|
|
149
|
+
lang?: string | null;
|
|
150
|
+
url?: string | null;
|
|
151
|
+
[key: string]: unknown;
|
|
152
|
+
}
|
|
153
|
+
interface InstagramUser {
|
|
154
|
+
id?: string | null;
|
|
155
|
+
username?: string | null;
|
|
156
|
+
fullName?: string | null;
|
|
157
|
+
biography?: string | null;
|
|
158
|
+
profilePicUrl?: string | null;
|
|
159
|
+
followerCount?: number | null;
|
|
160
|
+
followingCount?: number | null;
|
|
161
|
+
mediaCount?: number | null;
|
|
162
|
+
isVerified?: boolean;
|
|
163
|
+
isPrivate?: boolean;
|
|
164
|
+
[key: string]: unknown;
|
|
165
|
+
}
|
|
166
|
+
interface InstagramTag {
|
|
167
|
+
name?: string | null;
|
|
168
|
+
mediaCount?: number | null;
|
|
169
|
+
[key: string]: unknown;
|
|
170
|
+
}
|
|
171
|
+
interface Subreddit {
|
|
172
|
+
name?: string | null;
|
|
173
|
+
title?: string | null;
|
|
174
|
+
description?: string | null;
|
|
175
|
+
subscribers?: number | null;
|
|
176
|
+
activeUsers?: number | null;
|
|
177
|
+
createdAt?: string | null;
|
|
178
|
+
[key: string]: unknown;
|
|
179
|
+
}
|
|
180
|
+
interface RedditPost {
|
|
181
|
+
id: string;
|
|
182
|
+
title?: string | null;
|
|
183
|
+
text?: string | null;
|
|
184
|
+
url?: string | null;
|
|
185
|
+
author?: string | null;
|
|
186
|
+
subreddit?: string | null;
|
|
187
|
+
score?: number | null;
|
|
188
|
+
upvoteRatio?: number | null;
|
|
189
|
+
numComments?: number | null;
|
|
190
|
+
createdAt?: string | null;
|
|
191
|
+
permalink?: string | null;
|
|
192
|
+
isNsfw?: boolean;
|
|
193
|
+
[key: string]: unknown;
|
|
194
|
+
}
|
|
195
|
+
interface RedditUser {
|
|
196
|
+
username?: string | null;
|
|
197
|
+
id?: string | null;
|
|
198
|
+
createdAt?: string | null;
|
|
199
|
+
linkKarma?: number | null;
|
|
200
|
+
commentKarma?: number | null;
|
|
201
|
+
isGold?: boolean;
|
|
202
|
+
[key: string]: unknown;
|
|
203
|
+
}
|
|
204
|
+
interface LinkedInCompany {
|
|
205
|
+
id?: string | null;
|
|
206
|
+
name?: string | null;
|
|
207
|
+
universalName?: string | null;
|
|
208
|
+
description?: string | null;
|
|
209
|
+
website?: string | null;
|
|
210
|
+
industry?: string | null;
|
|
211
|
+
size?: string | null;
|
|
212
|
+
headquarters?: string | null;
|
|
213
|
+
logo?: string | null;
|
|
214
|
+
banner?: string | null;
|
|
215
|
+
employeeCount?: number | string | null;
|
|
216
|
+
followerCount?: number | null;
|
|
217
|
+
specialties?: string[] | null;
|
|
218
|
+
founded?: string | null;
|
|
219
|
+
[key: string]: unknown;
|
|
220
|
+
}
|
|
221
|
+
interface LinkedInJob {
|
|
222
|
+
id?: string | null;
|
|
223
|
+
title?: string | null;
|
|
224
|
+
company?: string | null;
|
|
225
|
+
companyId?: string | null;
|
|
226
|
+
location?: string | null;
|
|
227
|
+
description?: string | null;
|
|
228
|
+
employmentType?: string | null;
|
|
229
|
+
postedAt?: string | null;
|
|
230
|
+
applyUrl?: string | null;
|
|
231
|
+
[key: string]: unknown;
|
|
232
|
+
}
|
|
233
|
+
interface LinkedInPost {
|
|
234
|
+
id?: string | null;
|
|
235
|
+
text?: string | null;
|
|
236
|
+
author?: Record<string, unknown> | null;
|
|
237
|
+
likesCount?: number | null;
|
|
238
|
+
commentsCount?: number | null;
|
|
239
|
+
sharesCount?: number | null;
|
|
240
|
+
createdAt?: string | null;
|
|
241
|
+
[key: string]: unknown;
|
|
242
|
+
}
|
|
243
|
+
interface LinkedInUser {
|
|
244
|
+
username?: string | null;
|
|
245
|
+
firstName?: string | null;
|
|
246
|
+
lastName?: string | null;
|
|
247
|
+
headline?: string | null;
|
|
248
|
+
summary?: string | null;
|
|
249
|
+
profilePicUrl?: string | null;
|
|
250
|
+
location?: string | null;
|
|
251
|
+
followerCount?: number | null;
|
|
252
|
+
connectionCount?: number | null;
|
|
253
|
+
[key: string]: unknown;
|
|
254
|
+
}
|
|
255
|
+
interface TikTokVideo {
|
|
256
|
+
id?: string | null;
|
|
257
|
+
description?: string | null;
|
|
258
|
+
createdAt?: string | null;
|
|
259
|
+
author?: Record<string, unknown> | null;
|
|
260
|
+
stats?: Record<string, unknown> | null;
|
|
261
|
+
music?: Record<string, unknown> | null;
|
|
262
|
+
videoUrl?: string | null;
|
|
263
|
+
coverUrl?: string | null;
|
|
264
|
+
duration?: number | null;
|
|
265
|
+
[key: string]: unknown;
|
|
266
|
+
}
|
|
267
|
+
interface TikTokUser {
|
|
268
|
+
id?: string | null;
|
|
269
|
+
username?: string | null;
|
|
270
|
+
displayName?: string | null;
|
|
271
|
+
avatarUrl?: string | null;
|
|
272
|
+
bio?: string | null;
|
|
273
|
+
signature?: string | null;
|
|
274
|
+
verified?: boolean;
|
|
275
|
+
followers?: number | null;
|
|
276
|
+
following?: number | null;
|
|
277
|
+
hearts?: number | null;
|
|
278
|
+
videoCount?: number | null;
|
|
279
|
+
[key: string]: unknown;
|
|
280
|
+
}
|
|
281
|
+
interface TikTokComment {
|
|
282
|
+
id?: string | null;
|
|
283
|
+
text?: string | null;
|
|
284
|
+
user?: Record<string, unknown> | null;
|
|
285
|
+
likeCount?: number | null;
|
|
286
|
+
replyCount?: number | null;
|
|
287
|
+
createdAt?: string | null;
|
|
288
|
+
[key: string]: unknown;
|
|
289
|
+
}
|
|
290
|
+
interface TikTokCategory {
|
|
291
|
+
id?: string | null;
|
|
292
|
+
name?: string | null;
|
|
293
|
+
[key: string]: unknown;
|
|
294
|
+
}
|
|
295
|
+
interface YouTubeVideo {
|
|
296
|
+
id?: string | null;
|
|
297
|
+
title?: string | null;
|
|
298
|
+
description?: string | null;
|
|
299
|
+
channelId?: string | null;
|
|
300
|
+
channelTitle?: string | null;
|
|
301
|
+
viewCount?: number | null;
|
|
302
|
+
likeCount?: number | null;
|
|
303
|
+
commentCount?: number | null;
|
|
304
|
+
duration?: string | null;
|
|
305
|
+
publishedAt?: string | null;
|
|
306
|
+
thumbnail?: string | null;
|
|
307
|
+
keywords?: string[];
|
|
308
|
+
[key: string]: unknown;
|
|
309
|
+
}
|
|
310
|
+
interface YouTubeChannel {
|
|
311
|
+
id?: string | null;
|
|
312
|
+
title?: string | null;
|
|
313
|
+
description?: string | null;
|
|
314
|
+
subscriberCount?: number | null;
|
|
315
|
+
videoCount?: number | null;
|
|
316
|
+
viewCount?: number | null;
|
|
317
|
+
thumbnail?: string | null;
|
|
318
|
+
banner?: string | null;
|
|
319
|
+
createdAt?: string | null;
|
|
320
|
+
country?: string | null;
|
|
321
|
+
[key: string]: unknown;
|
|
322
|
+
}
|
|
323
|
+
interface YouTubeComment {
|
|
324
|
+
id?: string | null;
|
|
325
|
+
text?: string | null;
|
|
326
|
+
author?: string | null;
|
|
327
|
+
authorChannelId?: string | null;
|
|
328
|
+
authorAvatar?: string | null;
|
|
329
|
+
isVerified?: boolean;
|
|
330
|
+
likeCount?: number | null;
|
|
331
|
+
replyCount?: number | null;
|
|
332
|
+
publishedAt?: string | null;
|
|
333
|
+
[key: string]: unknown;
|
|
334
|
+
}
|
|
335
|
+
interface DcardForum {
|
|
336
|
+
alias?: string | null;
|
|
337
|
+
name?: string | null;
|
|
338
|
+
description?: string | null;
|
|
339
|
+
isSchool?: boolean;
|
|
340
|
+
postCount?: Record<string, unknown> | null;
|
|
341
|
+
subscriptionCount?: number | null;
|
|
342
|
+
[key: string]: unknown;
|
|
343
|
+
}
|
|
344
|
+
interface DcardPost {
|
|
345
|
+
id?: number | null;
|
|
346
|
+
title?: string | null;
|
|
347
|
+
excerpt?: string | null;
|
|
348
|
+
content?: string | null;
|
|
349
|
+
createdAt?: string | null;
|
|
350
|
+
updatedAt?: string | null;
|
|
351
|
+
forumAlias?: string | null;
|
|
352
|
+
forumName?: string | null;
|
|
353
|
+
commentCount?: number | null;
|
|
354
|
+
likeCount?: number | null;
|
|
355
|
+
topics?: string[];
|
|
356
|
+
media?: Record<string, unknown>[];
|
|
357
|
+
[key: string]: unknown;
|
|
358
|
+
}
|
|
359
|
+
interface DcardPersona {
|
|
360
|
+
username?: string | null;
|
|
361
|
+
nickname?: string | null;
|
|
362
|
+
postCount?: number | null;
|
|
363
|
+
gender?: string | null;
|
|
364
|
+
[key: string]: unknown;
|
|
365
|
+
}
|
|
366
|
+
interface GMapsPlace {
|
|
367
|
+
name?: string | null;
|
|
368
|
+
category?: string | null;
|
|
369
|
+
address?: string | null;
|
|
370
|
+
website?: string | null;
|
|
371
|
+
phone?: string | null;
|
|
372
|
+
rating?: number | null;
|
|
373
|
+
description?: string | null;
|
|
374
|
+
hours?: string | null;
|
|
375
|
+
lat?: number | null;
|
|
376
|
+
lng?: number | null;
|
|
377
|
+
placeId?: string | null;
|
|
378
|
+
priceLevel?: string | null;
|
|
379
|
+
photoCount?: number | null;
|
|
380
|
+
url?: string | null;
|
|
381
|
+
[key: string]: unknown;
|
|
382
|
+
}
|
|
383
|
+
interface Job104Job {
|
|
384
|
+
jobId?: string | null;
|
|
385
|
+
jobName?: string | null;
|
|
386
|
+
companyId?: string | null;
|
|
387
|
+
companyName?: string | null;
|
|
388
|
+
area?: string | null;
|
|
389
|
+
description?: string | null;
|
|
390
|
+
salary?: string | null;
|
|
391
|
+
employmentType?: string | null;
|
|
392
|
+
appearedAt?: string | null;
|
|
393
|
+
link?: string | null;
|
|
394
|
+
tags?: string[];
|
|
395
|
+
requirements?: string[];
|
|
396
|
+
[key: string]: unknown;
|
|
397
|
+
}
|
|
398
|
+
interface Job104Company {
|
|
399
|
+
id?: string | null;
|
|
400
|
+
name?: string | null;
|
|
401
|
+
description?: string | null;
|
|
402
|
+
industry?: string | null;
|
|
403
|
+
employeeCount?: string | null;
|
|
404
|
+
website?: string | null;
|
|
405
|
+
address?: string | null;
|
|
406
|
+
logoUrl?: string | null;
|
|
407
|
+
[key: string]: unknown;
|
|
408
|
+
}
|
|
409
|
+
interface BulkJob {
|
|
410
|
+
jobId: string;
|
|
411
|
+
status: string;
|
|
412
|
+
[key: string]: unknown;
|
|
413
|
+
}
|
|
414
|
+
interface BulkJobStatus {
|
|
415
|
+
jobId: string;
|
|
416
|
+
status: string;
|
|
417
|
+
total?: number | null;
|
|
418
|
+
completed?: number | null;
|
|
419
|
+
failed?: number | null;
|
|
420
|
+
createdAt?: string | null;
|
|
421
|
+
[key: string]: unknown;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* APIResource Base Class
|
|
426
|
+
*
|
|
427
|
+
* All platform namespaces inherit from APIResource.
|
|
428
|
+
* Handles HTTP call delegation, response wrapping, header parsing, and pagination.
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
declare class APIResource {
|
|
432
|
+
protected readonly _transport: Transport;
|
|
433
|
+
constructor(transport: Transport);
|
|
434
|
+
protected _get<T>(path: string, options?: {
|
|
435
|
+
params?: Record<string, unknown>;
|
|
436
|
+
castTo?: (raw: Record<string, unknown>) => T;
|
|
437
|
+
}): Promise<APIResponse<T>>;
|
|
438
|
+
protected _post<T>(path: string, options?: {
|
|
439
|
+
body?: Record<string, unknown>;
|
|
440
|
+
castTo?: (raw: Record<string, unknown>) => T;
|
|
441
|
+
}): Promise<APIResponse<T>>;
|
|
442
|
+
protected _getList<T>(path: string, options: {
|
|
443
|
+
params?: Record<string, unknown>;
|
|
444
|
+
itemsKey: string;
|
|
445
|
+
castTo?: (raw: Record<string, unknown>) => T;
|
|
446
|
+
}): Promise<APIResponse<T[]>>;
|
|
447
|
+
protected _request<T>(method: string, path: string, options?: {
|
|
448
|
+
params?: Record<string, unknown>;
|
|
449
|
+
body?: Record<string, unknown>;
|
|
450
|
+
castTo?: (raw: Record<string, unknown>) => T;
|
|
451
|
+
}): Promise<APIResponse<T>>;
|
|
452
|
+
protected _paginate<T>(path: string, options: {
|
|
453
|
+
params: Record<string, unknown>;
|
|
454
|
+
itemsKey?: string;
|
|
455
|
+
cursorKey?: string;
|
|
456
|
+
hasMoreKey?: string;
|
|
457
|
+
castTo?: (raw: Record<string, unknown>) => T;
|
|
458
|
+
}): AsyncGenerator<T>;
|
|
459
|
+
protected _paginateByPage<T>(path: string, options: {
|
|
460
|
+
params: Record<string, unknown>;
|
|
461
|
+
itemsKey?: string;
|
|
462
|
+
pageKey?: string;
|
|
463
|
+
castTo?: (raw: Record<string, unknown>) => T;
|
|
464
|
+
}): AsyncGenerator<T>;
|
|
465
|
+
protected _paginateByOffset<T>(path: string, options: {
|
|
466
|
+
params: Record<string, unknown>;
|
|
467
|
+
itemsKey?: string;
|
|
468
|
+
countKey?: string;
|
|
469
|
+
castTo?: (raw: Record<string, unknown>) => T;
|
|
470
|
+
}): AsyncGenerator<T>;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
declare class Dcard extends APIResource {
|
|
474
|
+
getForum(alias: string): Promise<APIResponse<DcardForum>>;
|
|
475
|
+
getForumPosts(alias: string, options?: {
|
|
476
|
+
count?: number;
|
|
477
|
+
popular?: boolean;
|
|
478
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
479
|
+
searchPosts(q: string, options?: {
|
|
480
|
+
count?: number;
|
|
481
|
+
offset?: number;
|
|
482
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
483
|
+
getPersona(username: string): Promise<APIResponse<DcardPersona>>;
|
|
484
|
+
iterSearchPosts(q: string, options?: {
|
|
485
|
+
count?: number;
|
|
486
|
+
}): AsyncGenerator<DcardPost>;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
declare class Facebook extends APIResource {
|
|
490
|
+
getUser(username: string): Promise<APIResponse<FacebookUser>>;
|
|
491
|
+
getUserPosts(username: string): Promise<APIResponse<FacebookPost[]>>;
|
|
492
|
+
getPost(options: {
|
|
493
|
+
url: string;
|
|
494
|
+
}): Promise<APIResponse<FacebookPost>>;
|
|
495
|
+
getPostComments(options: {
|
|
496
|
+
url: string;
|
|
497
|
+
cursor?: string;
|
|
498
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
499
|
+
searchPosts(q: string, options?: {
|
|
500
|
+
count?: number;
|
|
501
|
+
cursor?: string;
|
|
502
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
503
|
+
marketplaceBrowse(location: string, options?: {
|
|
504
|
+
category?: string;
|
|
505
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
506
|
+
marketplaceSearch(q: string, options?: {
|
|
507
|
+
location?: string;
|
|
508
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
509
|
+
marketplaceItem(listingId: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
510
|
+
iterPostComments(options: {
|
|
511
|
+
url: string;
|
|
512
|
+
}): AsyncGenerator<Record<string, unknown>>;
|
|
513
|
+
iterSearchPosts(q: string, options?: {
|
|
514
|
+
count?: number;
|
|
515
|
+
}): AsyncGenerator<FacebookPost>;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
declare class GMaps extends APIResource {
|
|
519
|
+
search(q: string, options?: {
|
|
520
|
+
language?: string;
|
|
521
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
522
|
+
getPlace(query: string, options?: {
|
|
523
|
+
language?: string;
|
|
524
|
+
}): Promise<APIResponse<GMapsPlace>>;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
declare class Instagram extends APIResource {
|
|
528
|
+
getUser(username: string): Promise<APIResponse<InstagramUser>>;
|
|
529
|
+
searchTags(q: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
530
|
+
getPost(shortcode: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
531
|
+
getPostComments(shortcode: string, options?: {
|
|
532
|
+
cursor?: string;
|
|
533
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
534
|
+
getUserPosts(username: string, options?: {
|
|
535
|
+
cursor?: string;
|
|
536
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
537
|
+
iterUserPosts(username: string): AsyncGenerator<Record<string, unknown>>;
|
|
538
|
+
iterPostComments(shortcode: string): AsyncGenerator<Record<string, unknown>>;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
declare class Job104 extends APIResource {
|
|
542
|
+
searchJobs(options?: {
|
|
543
|
+
q?: string;
|
|
544
|
+
welfare?: string;
|
|
545
|
+
area?: string;
|
|
546
|
+
page?: number;
|
|
547
|
+
count?: number;
|
|
548
|
+
}): Promise<APIResponse<Job104Job[]>>;
|
|
549
|
+
getCompany(companyId: string): Promise<APIResponse<Job104Company>>;
|
|
550
|
+
getJob(jobId: string): Promise<APIResponse<Job104Job>>;
|
|
551
|
+
iterSearchJobs(options?: {
|
|
552
|
+
q?: string;
|
|
553
|
+
welfare?: string;
|
|
554
|
+
area?: string;
|
|
555
|
+
count?: number;
|
|
556
|
+
}): AsyncGenerator<Job104Job>;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
declare class LinkedIn extends APIResource {
|
|
560
|
+
getCompany(companyId: string): Promise<APIResponse<LinkedInCompany>>;
|
|
561
|
+
getCompanyJobs(companyId: string, options?: {
|
|
562
|
+
count?: number;
|
|
563
|
+
offset?: number;
|
|
564
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
565
|
+
searchJobs(query: string, options?: {
|
|
566
|
+
location?: string;
|
|
567
|
+
count?: number;
|
|
568
|
+
offset?: number;
|
|
569
|
+
}): Promise<APIResponse<LinkedInJob[]>>;
|
|
570
|
+
getJob(jobId: string): Promise<APIResponse<LinkedInJob>>;
|
|
571
|
+
getPost(postId: string): Promise<APIResponse<LinkedInPost>>;
|
|
572
|
+
searchUsers(query: string, options?: {
|
|
573
|
+
count?: number;
|
|
574
|
+
offset?: number;
|
|
575
|
+
}): Promise<APIResponse<LinkedInUser[]>>;
|
|
576
|
+
getUser(username: string): Promise<APIResponse<LinkedInUser>>;
|
|
577
|
+
iterCompanyJobs(companyId: string, options?: {
|
|
578
|
+
count?: number;
|
|
579
|
+
}): AsyncGenerator<LinkedInJob>;
|
|
580
|
+
iterSearchJobs(query: string, options?: {
|
|
581
|
+
location?: string;
|
|
582
|
+
count?: number;
|
|
583
|
+
}): AsyncGenerator<LinkedInJob>;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
declare class Reddit extends APIResource {
|
|
587
|
+
getSubreddit(name: string): Promise<APIResponse<Subreddit>>;
|
|
588
|
+
getSubredditPosts(name: string, options?: {
|
|
589
|
+
sort?: string;
|
|
590
|
+
t?: string;
|
|
591
|
+
count?: number;
|
|
592
|
+
}): Promise<APIResponse<RedditPost[]>>;
|
|
593
|
+
getPost(postId: string): Promise<APIResponse<RedditPost>>;
|
|
594
|
+
searchPosts(q: string, options?: {
|
|
595
|
+
sort?: string;
|
|
596
|
+
count?: number;
|
|
597
|
+
}): Promise<APIResponse<RedditPost[]>>;
|
|
598
|
+
getUser(username: string): Promise<APIResponse<RedditUser>>;
|
|
599
|
+
getUserPosts(username: string, options?: {
|
|
600
|
+
sort?: string;
|
|
601
|
+
t?: string;
|
|
602
|
+
count?: number;
|
|
603
|
+
after?: string;
|
|
604
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
declare class Threads extends APIResource {
|
|
608
|
+
getPost(postId: string, options?: {
|
|
609
|
+
mode?: string;
|
|
610
|
+
}): Promise<APIResponse<ThreadsPost>>;
|
|
611
|
+
getPosts(ids: string[], options?: {
|
|
612
|
+
mode?: string;
|
|
613
|
+
}): Promise<APIResponse<ThreadsPost[]>>;
|
|
614
|
+
searchPosts(q: string, options?: {
|
|
615
|
+
count?: number;
|
|
616
|
+
}): Promise<APIResponse<ThreadsPost[]>>;
|
|
617
|
+
getUser(username: string): Promise<APIResponse<ThreadsUser>>;
|
|
618
|
+
getUserPosts(userId: string, options?: {
|
|
619
|
+
cursor?: string;
|
|
620
|
+
count?: number;
|
|
621
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
622
|
+
getUserReplies(userId: string, options?: {
|
|
623
|
+
cursor?: string;
|
|
624
|
+
count?: number;
|
|
625
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
626
|
+
searchUsers(q: string, options?: {
|
|
627
|
+
count?: number;
|
|
628
|
+
}): Promise<APIResponse<ThreadsUser[]>>;
|
|
629
|
+
getPublicFeed(options?: {
|
|
630
|
+
cursor?: string;
|
|
631
|
+
count?: number;
|
|
632
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
633
|
+
bulkSubmit(ids: string[], options?: {
|
|
634
|
+
type?: string;
|
|
635
|
+
}): Promise<APIResponse<BulkJob>>;
|
|
636
|
+
bulkStatus(jobId: string): Promise<APIResponse<BulkJobStatus>>;
|
|
637
|
+
bulkResults(jobId: string): Promise<APIResponse<ThreadsPost[]>>;
|
|
638
|
+
bulkSubmitAndWait(ids: string[], options?: {
|
|
639
|
+
pollInterval?: number;
|
|
640
|
+
timeout?: number;
|
|
641
|
+
}): Promise<APIResponse<ThreadsPost[]>>;
|
|
642
|
+
iterUserPosts(userId: string, options?: {
|
|
643
|
+
count?: number;
|
|
644
|
+
}): AsyncGenerator<ThreadsPost>;
|
|
645
|
+
iterUserReplies(userId: string, options?: {
|
|
646
|
+
count?: number;
|
|
647
|
+
}): AsyncGenerator<ThreadsPost>;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
declare class TikTok extends APIResource {
|
|
651
|
+
getVideo(videoId: string): Promise<APIResponse<TikTokVideo>>;
|
|
652
|
+
getUser(username: string): Promise<APIResponse<TikTokUser>>;
|
|
653
|
+
getUserVideos(username: string, options?: {
|
|
654
|
+
count?: number;
|
|
655
|
+
}): Promise<APIResponse<TikTokVideo[]>>;
|
|
656
|
+
getVideoComments(videoId: string, options?: {
|
|
657
|
+
cursor?: string;
|
|
658
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
659
|
+
getCategories(options?: {
|
|
660
|
+
category?: string;
|
|
661
|
+
count?: number;
|
|
662
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
663
|
+
search(keyword: string, options?: {
|
|
664
|
+
count?: number;
|
|
665
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
666
|
+
getVideoSubtitles(videoId: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
667
|
+
iterVideoComments(videoId: string): AsyncGenerator<TikTokComment>;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
declare class WebFetch extends APIResource {
|
|
671
|
+
fetch(url: string, options?: {
|
|
672
|
+
format?: string;
|
|
673
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
declare class X extends APIResource {
|
|
677
|
+
getUser(username: string): Promise<APIResponse<XUser>>;
|
|
678
|
+
getUserPosts(username: string, options?: {
|
|
679
|
+
count?: number;
|
|
680
|
+
cursor?: string;
|
|
681
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
682
|
+
getPost(postId: string): Promise<APIResponse<XPost>>;
|
|
683
|
+
searchPosts(q: string, options?: {
|
|
684
|
+
count?: number;
|
|
685
|
+
cursor?: string;
|
|
686
|
+
product?: string;
|
|
687
|
+
}): Promise<APIResponse<XPost[]>>;
|
|
688
|
+
iterUserPosts(username: string, options?: {
|
|
689
|
+
count?: number;
|
|
690
|
+
}): AsyncGenerator<XPost>;
|
|
691
|
+
iterSearchPosts(q: string, options?: {
|
|
692
|
+
count?: number;
|
|
693
|
+
product?: string;
|
|
694
|
+
}): AsyncGenerator<XPost>;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
declare class YouTube extends APIResource {
|
|
698
|
+
getVideo(videoId: string): Promise<APIResponse<YouTubeVideo>>;
|
|
699
|
+
getChannel(channelId: string): Promise<APIResponse<YouTubeChannel>>;
|
|
700
|
+
search(q: string, options?: {
|
|
701
|
+
count?: number;
|
|
702
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
703
|
+
getVideoComments(videoId: string, options?: {
|
|
704
|
+
count?: number;
|
|
705
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
706
|
+
getVideoTranscription(videoId: string, options?: {
|
|
707
|
+
language?: string;
|
|
708
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
709
|
+
iterSearch(q: string, options?: {
|
|
710
|
+
count?: number;
|
|
711
|
+
}): AsyncGenerator<YouTubeVideo>;
|
|
712
|
+
iterVideoComments(videoId: string, options?: {
|
|
713
|
+
count?: number;
|
|
714
|
+
}): AsyncGenerator<YouTubeComment>;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* ByCrawl Client
|
|
719
|
+
*
|
|
720
|
+
* Main entry point for the SDK. Wires up all platform namespaces
|
|
721
|
+
* and manages the HTTP transport.
|
|
722
|
+
*/
|
|
723
|
+
|
|
724
|
+
interface ByCrawlOptions {
|
|
725
|
+
apiKey?: string;
|
|
726
|
+
baseUrl?: string;
|
|
727
|
+
timeout?: number;
|
|
728
|
+
maxRetries?: number;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* ByCrawl client for the ByCrawl social media data API.
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```ts
|
|
735
|
+
* const client = new ByCrawl({ apiKey: "sk_byc_..." });
|
|
736
|
+
* const post = await client.threads.getPost("DQt-ox3kdE4");
|
|
737
|
+
* console.log(post.data);
|
|
738
|
+
* ```
|
|
739
|
+
*/
|
|
740
|
+
declare class ByCrawl {
|
|
741
|
+
readonly threads: Threads;
|
|
742
|
+
readonly facebook: Facebook;
|
|
743
|
+
readonly x: X;
|
|
744
|
+
readonly instagram: Instagram;
|
|
745
|
+
readonly reddit: Reddit;
|
|
746
|
+
readonly linkedin: LinkedIn;
|
|
747
|
+
readonly tiktok: TikTok;
|
|
748
|
+
readonly youtube: YouTube;
|
|
749
|
+
readonly dcard: Dcard;
|
|
750
|
+
readonly gmaps: GMaps;
|
|
751
|
+
readonly job104: Job104;
|
|
752
|
+
readonly web: WebFetch;
|
|
753
|
+
private readonly _transport;
|
|
754
|
+
constructor(options?: ByCrawlOptions);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* ByCrawl Exception Hierarchy
|
|
759
|
+
*
|
|
760
|
+
* All SDK exceptions inherit from ByCrawlError.
|
|
761
|
+
* HTTP errors are mapped to specific subclasses by status code.
|
|
762
|
+
*/
|
|
763
|
+
declare class ByCrawlError extends Error {
|
|
764
|
+
constructor(message: string);
|
|
765
|
+
}
|
|
766
|
+
declare class APIError extends ByCrawlError {
|
|
767
|
+
readonly statusCode: number;
|
|
768
|
+
readonly body: Record<string, unknown> | null;
|
|
769
|
+
constructor(message: string, options: {
|
|
770
|
+
statusCode: number;
|
|
771
|
+
body?: Record<string, unknown> | null;
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
declare class AuthenticationError extends APIError {
|
|
775
|
+
constructor(message?: string, body?: Record<string, unknown> | null);
|
|
776
|
+
}
|
|
777
|
+
declare class PermissionError extends APIError {
|
|
778
|
+
constructor(message?: string, body?: Record<string, unknown> | null);
|
|
779
|
+
}
|
|
780
|
+
declare class NotFoundError extends APIError {
|
|
781
|
+
constructor(message?: string, body?: Record<string, unknown> | null);
|
|
782
|
+
}
|
|
783
|
+
declare class RateLimitError extends APIError {
|
|
784
|
+
readonly retryAfter: number | null;
|
|
785
|
+
constructor(message?: string, options?: {
|
|
786
|
+
retryAfter?: number | null;
|
|
787
|
+
body?: Record<string, unknown> | null;
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
declare class ServerError extends APIError {
|
|
791
|
+
constructor(message: string, options: {
|
|
792
|
+
statusCode: number;
|
|
793
|
+
body?: Record<string, unknown> | null;
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
declare class TimeoutError extends ByCrawlError {
|
|
797
|
+
constructor(message?: string);
|
|
798
|
+
}
|
|
799
|
+
declare class ConnectionError extends ByCrawlError {
|
|
800
|
+
constructor(message?: string);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export { APIError, type APIResponse, AuthenticationError, type BulkJob, type BulkJobStatus, ByCrawl, ByCrawlError, type ByCrawlOptions, ConnectionError, type CreditInfo, type DcardForum, type DcardPersona, type DcardPost, type FacebookPost, type FacebookUser, type GMapsPlace, type InstagramTag, type InstagramUser, type Job104Company, type Job104Job, type LinkedInCompany, type LinkedInJob, type LinkedInPost, type LinkedInUser, NotFoundError, type PaginatedData, PermissionError, type RateLimit, RateLimitError, type RedditPost, type RedditUser, SDK_VERSION, ServerError, type Subreddit, type ThreadsMedia, type ThreadsPost, type ThreadsPostStats, type ThreadsUser, type TikTokCategory, type TikTokComment, type TikTokUser, type TikTokVideo, TimeoutError, type XPost, type XUser, type YouTubeChannel, type YouTubeComment, type YouTubeVideo };
|