@bycrawl/nodejs-sdk 0.2.0 → 0.3.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/dist/index.cjs +188 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +102 -28
- package/dist/index.d.ts +102 -28
- package/dist/index.js +188 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -406,20 +406,6 @@ interface Job104Company {
|
|
|
406
406
|
logoUrl?: string | null;
|
|
407
407
|
[key: string]: unknown;
|
|
408
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
409
|
|
|
424
410
|
/**
|
|
425
411
|
* APIResource Base Class
|
|
@@ -527,6 +513,47 @@ declare class GMaps extends APIResource {
|
|
|
527
513
|
getPlace(query: string, options?: {
|
|
528
514
|
language?: string;
|
|
529
515
|
}): Promise<APIResponse<GMapsPlace>>;
|
|
516
|
+
getPlaceReviews(query: string, options?: {
|
|
517
|
+
sort?: string;
|
|
518
|
+
pageToken?: string;
|
|
519
|
+
language?: string;
|
|
520
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
declare class Google extends APIResource {
|
|
524
|
+
search(q: string, options?: {
|
|
525
|
+
num?: number;
|
|
526
|
+
language?: string;
|
|
527
|
+
country?: string;
|
|
528
|
+
page?: number;
|
|
529
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
530
|
+
news(q: string, options?: {
|
|
531
|
+
language?: string;
|
|
532
|
+
country?: string;
|
|
533
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
534
|
+
trends(q: string, options?: {
|
|
535
|
+
timeframe?: string;
|
|
536
|
+
geo?: string;
|
|
537
|
+
category?: number;
|
|
538
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
539
|
+
finance(ticker: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
540
|
+
shopping(q: string, options?: {
|
|
541
|
+
num?: number;
|
|
542
|
+
min_price?: number;
|
|
543
|
+
max_price?: number;
|
|
544
|
+
country?: string;
|
|
545
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
declare class HackerNews extends APIResource {
|
|
549
|
+
getItem(itemId: number): Promise<APIResponse<Record<string, unknown>>>;
|
|
550
|
+
getUser(username: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
551
|
+
getStories(storyType: string, options?: {
|
|
552
|
+
count?: number;
|
|
553
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
554
|
+
getItemComments(itemId: number, options?: {
|
|
555
|
+
depth?: number;
|
|
556
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
530
557
|
}
|
|
531
558
|
|
|
532
559
|
declare class Instagram extends APIResource {
|
|
@@ -562,11 +589,17 @@ declare class Job104 extends APIResource {
|
|
|
562
589
|
}
|
|
563
590
|
|
|
564
591
|
declare class LinkedIn extends APIResource {
|
|
592
|
+
searchCompanies(q: string, options?: {
|
|
593
|
+
count?: number;
|
|
594
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
565
595
|
getCompany(companyId: string): Promise<APIResponse<LinkedInCompany>>;
|
|
566
596
|
getCompanyJobs(companyId: string, options?: {
|
|
567
597
|
count?: number;
|
|
568
598
|
offset?: number;
|
|
569
599
|
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
600
|
+
getCompanyPosts(companyId: string, options?: {
|
|
601
|
+
count?: number;
|
|
602
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
570
603
|
searchJobs(q: string, options?: {
|
|
571
604
|
location?: string;
|
|
572
605
|
count?: number;
|
|
@@ -579,6 +612,12 @@ declare class LinkedIn extends APIResource {
|
|
|
579
612
|
offset?: number;
|
|
580
613
|
}): Promise<APIResponse<LinkedInUser[]>>;
|
|
581
614
|
getUser(username: string): Promise<APIResponse<LinkedInUser>>;
|
|
615
|
+
getCompanyEmployees(companyId: string, options?: {
|
|
616
|
+
count?: number;
|
|
617
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
618
|
+
getUserPosts(username: string, options?: {
|
|
619
|
+
count?: number;
|
|
620
|
+
}): Promise<APIResponse<LinkedInPost[]>>;
|
|
582
621
|
iterCompanyJobs(companyId: string, options?: {
|
|
583
622
|
count?: number;
|
|
584
623
|
}): AsyncGenerator<LinkedInJob>;
|
|
@@ -588,6 +627,37 @@ declare class LinkedIn extends APIResource {
|
|
|
588
627
|
}): AsyncGenerator<LinkedInJob>;
|
|
589
628
|
}
|
|
590
629
|
|
|
630
|
+
declare class Luma extends APIResource {
|
|
631
|
+
getEvent(eventId: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
632
|
+
getPlaceEvents(placeId: string, options?: {
|
|
633
|
+
count?: number;
|
|
634
|
+
cursor?: string;
|
|
635
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
636
|
+
searchEvents(placeId: string, q: string, options?: {
|
|
637
|
+
count?: number;
|
|
638
|
+
cursor?: string;
|
|
639
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
640
|
+
getCategories(): Promise<APIResponse<Record<string, unknown>>>;
|
|
641
|
+
getCalendarEvents(calendarId: string, options?: {
|
|
642
|
+
count?: number;
|
|
643
|
+
cursor?: string;
|
|
644
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
645
|
+
getPlace(placeId: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
declare class ProductHunt extends APIResource {
|
|
649
|
+
getPosts(options?: {
|
|
650
|
+
count?: number;
|
|
651
|
+
date?: string;
|
|
652
|
+
period?: string;
|
|
653
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
654
|
+
searchPosts(q: string, options?: {
|
|
655
|
+
count?: number;
|
|
656
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
657
|
+
getPost(slug: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
658
|
+
getReviews(slug: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
659
|
+
}
|
|
660
|
+
|
|
591
661
|
declare class PTT extends APIResource {
|
|
592
662
|
getBoard(boardName: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
593
663
|
getBoardPosts(boardName: string, options?: {
|
|
@@ -641,7 +711,16 @@ declare class Threads extends APIResource {
|
|
|
641
711
|
getPosts(ids: string[]): Promise<APIResponse<ThreadsPost[]>>;
|
|
642
712
|
searchPosts(q: string, options?: {
|
|
643
713
|
count?: number;
|
|
714
|
+
search_type?: string;
|
|
715
|
+
cursor?: string;
|
|
644
716
|
}): Promise<APIResponse<ThreadsPost[]>>;
|
|
717
|
+
/**
|
|
718
|
+
* Get direct replies to a Threads post.
|
|
719
|
+
*
|
|
720
|
+
* Returns `{rootPost, replies, totalReplies, hasMore}`. Anonymous SSR
|
|
721
|
+
* embeds ~20 top-level replies per post; pagination is not supported.
|
|
722
|
+
*/
|
|
723
|
+
getPostReplies(postId: string): Promise<APIResponse<Record<string, unknown>>>;
|
|
645
724
|
getUser(username: string): Promise<APIResponse<ThreadsUser>>;
|
|
646
725
|
getUserPosts(userId: string, options?: {
|
|
647
726
|
cursor?: string;
|
|
@@ -657,16 +736,8 @@ declare class Threads extends APIResource {
|
|
|
657
736
|
getPublicFeed(options?: {
|
|
658
737
|
cursor?: string;
|
|
659
738
|
count?: number;
|
|
739
|
+
country?: string;
|
|
660
740
|
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
661
|
-
bulkSubmit(ids: string[], options?: {
|
|
662
|
-
type?: string;
|
|
663
|
-
}): Promise<APIResponse<BulkJob>>;
|
|
664
|
-
bulkStatus(jobId: string): Promise<APIResponse<BulkJobStatus>>;
|
|
665
|
-
bulkResults(jobId: string): Promise<APIResponse<ThreadsPost[]>>;
|
|
666
|
-
bulkSubmitAndWait(ids: string[], options?: {
|
|
667
|
-
pollInterval?: number;
|
|
668
|
-
timeout?: number;
|
|
669
|
-
}): Promise<APIResponse<ThreadsPost[]>>;
|
|
670
741
|
iterUserPosts(userId: string, options?: {
|
|
671
742
|
count?: number;
|
|
672
743
|
}): AsyncGenerator<ThreadsPost>;
|
|
@@ -684,10 +755,6 @@ declare class TikTok extends APIResource {
|
|
|
684
755
|
getVideoComments(videoId: string, options?: {
|
|
685
756
|
cursor?: string;
|
|
686
757
|
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
687
|
-
getCategories(options?: {
|
|
688
|
-
category?: string;
|
|
689
|
-
count?: number;
|
|
690
|
-
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
691
758
|
search(q: string, options?: {
|
|
692
759
|
count?: number;
|
|
693
760
|
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
@@ -716,6 +783,9 @@ declare class WebFetch extends APIResource {
|
|
|
716
783
|
fetch(url: string, options?: {
|
|
717
784
|
format?: string;
|
|
718
785
|
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
786
|
+
search(q: string, options?: {
|
|
787
|
+
count?: number;
|
|
788
|
+
}): Promise<APIResponse<Record<string, unknown>>>;
|
|
719
789
|
}
|
|
720
790
|
|
|
721
791
|
declare class X extends APIResource {
|
|
@@ -793,7 +863,11 @@ declare class ByCrawl {
|
|
|
793
863
|
readonly youtube: YouTube;
|
|
794
864
|
readonly dcard: Dcard;
|
|
795
865
|
readonly gmaps: GMaps;
|
|
866
|
+
readonly google: Google;
|
|
867
|
+
readonly hackernews: HackerNews;
|
|
796
868
|
readonly job104: Job104;
|
|
869
|
+
readonly luma: Luma;
|
|
870
|
+
readonly producthunt: ProductHunt;
|
|
797
871
|
readonly trustpilot: Trustpilot;
|
|
798
872
|
readonly ptt: PTT;
|
|
799
873
|
readonly rent591: Rent591;
|
|
@@ -848,4 +922,4 @@ declare class ConnectionError extends ByCrawlError {
|
|
|
848
922
|
constructor(message?: string);
|
|
849
923
|
}
|
|
850
924
|
|
|
851
|
-
export { APIError, type APIResponse, AuthenticationError,
|
|
925
|
+
export { APIError, type APIResponse, AuthenticationError, 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 };
|
package/dist/index.js
CHANGED
|
@@ -507,6 +507,82 @@ var GMaps = class extends APIResource {
|
|
|
507
507
|
castTo: (r) => r
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
|
+
async getPlaceReviews(query, options) {
|
|
511
|
+
return this._get(`/gmaps/places/reviews`, {
|
|
512
|
+
params: {
|
|
513
|
+
query,
|
|
514
|
+
sort: options?.sort,
|
|
515
|
+
pageToken: options?.pageToken,
|
|
516
|
+
language: options?.language
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
// src/platforms/google.ts
|
|
523
|
+
var Google = class extends APIResource {
|
|
524
|
+
async search(q, options) {
|
|
525
|
+
return this._get(`/google/search`, {
|
|
526
|
+
params: {
|
|
527
|
+
q,
|
|
528
|
+
num: options?.num,
|
|
529
|
+
language: options?.language,
|
|
530
|
+
country: options?.country,
|
|
531
|
+
page: options?.page
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
async news(q, options) {
|
|
536
|
+
return this._get(`/google/news`, {
|
|
537
|
+
params: { q, language: options?.language, country: options?.country }
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
async trends(q, options) {
|
|
541
|
+
return this._get(`/google/trends`, {
|
|
542
|
+
params: {
|
|
543
|
+
q,
|
|
544
|
+
timeframe: options?.timeframe,
|
|
545
|
+
geo: options?.geo,
|
|
546
|
+
category: options?.category
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
async finance(ticker) {
|
|
551
|
+
return this._get(`/google/finance`, {
|
|
552
|
+
params: { ticker }
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
async shopping(q, options) {
|
|
556
|
+
return this._get(`/google/shopping`, {
|
|
557
|
+
params: {
|
|
558
|
+
q,
|
|
559
|
+
num: options?.num,
|
|
560
|
+
min_price: options?.min_price,
|
|
561
|
+
max_price: options?.max_price,
|
|
562
|
+
country: options?.country
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
// src/platforms/hackernews.ts
|
|
569
|
+
var HackerNews = class extends APIResource {
|
|
570
|
+
async getItem(itemId) {
|
|
571
|
+
return this._get(`/hackernews/items/${itemId}`);
|
|
572
|
+
}
|
|
573
|
+
async getUser(username) {
|
|
574
|
+
return this._get(`/hackernews/users/${username}`);
|
|
575
|
+
}
|
|
576
|
+
async getStories(storyType, options) {
|
|
577
|
+
return this._get(`/hackernews/stories/${storyType}`, {
|
|
578
|
+
params: { count: options?.count }
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
async getItemComments(itemId, options) {
|
|
582
|
+
return this._get(`/hackernews/items/${itemId}/comments`, {
|
|
583
|
+
params: { depth: options?.depth }
|
|
584
|
+
});
|
|
585
|
+
}
|
|
510
586
|
};
|
|
511
587
|
|
|
512
588
|
// src/platforms/instagram.ts
|
|
@@ -590,6 +666,11 @@ var Job104 = class extends APIResource {
|
|
|
590
666
|
|
|
591
667
|
// src/platforms/linkedin.ts
|
|
592
668
|
var LinkedIn = class extends APIResource {
|
|
669
|
+
async searchCompanies(q, options) {
|
|
670
|
+
return this._get(`/linkedin/companies/search`, {
|
|
671
|
+
params: { q, count: options?.count }
|
|
672
|
+
});
|
|
673
|
+
}
|
|
593
674
|
async getCompany(companyId) {
|
|
594
675
|
return this._get(`/linkedin/companies/${companyId}`, {
|
|
595
676
|
castTo: (r) => r
|
|
@@ -600,6 +681,11 @@ var LinkedIn = class extends APIResource {
|
|
|
600
681
|
params: { count: options?.count, offset: options?.offset }
|
|
601
682
|
});
|
|
602
683
|
}
|
|
684
|
+
async getCompanyPosts(companyId, options) {
|
|
685
|
+
return this._get(`/linkedin/companies/${companyId}/posts`, {
|
|
686
|
+
params: { count: options?.count }
|
|
687
|
+
});
|
|
688
|
+
}
|
|
603
689
|
async searchJobs(q, options) {
|
|
604
690
|
return this._getList(`/linkedin/jobs/search`, {
|
|
605
691
|
params: {
|
|
@@ -634,6 +720,18 @@ var LinkedIn = class extends APIResource {
|
|
|
634
720
|
castTo: (r) => r
|
|
635
721
|
});
|
|
636
722
|
}
|
|
723
|
+
async getCompanyEmployees(companyId, options) {
|
|
724
|
+
return this._get(`/linkedin/companies/${companyId}/employees`, {
|
|
725
|
+
params: { count: options?.count ?? 25 }
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
async getUserPosts(username, options) {
|
|
729
|
+
return this._getList(`/linkedin/users/${username}/posts`, {
|
|
730
|
+
params: { count: options?.count ?? 20 },
|
|
731
|
+
itemsKey: "posts",
|
|
732
|
+
castTo: (r) => r
|
|
733
|
+
});
|
|
734
|
+
}
|
|
637
735
|
// -- Auto-pagination iterators --
|
|
638
736
|
iterCompanyJobs(companyId, options) {
|
|
639
737
|
const count = options?.count ?? 10;
|
|
@@ -653,6 +751,63 @@ var LinkedIn = class extends APIResource {
|
|
|
653
751
|
}
|
|
654
752
|
};
|
|
655
753
|
|
|
754
|
+
// src/platforms/luma.ts
|
|
755
|
+
var Luma = class extends APIResource {
|
|
756
|
+
async getEvent(eventId) {
|
|
757
|
+
return this._get(`/luma/events/${eventId}`);
|
|
758
|
+
}
|
|
759
|
+
async getPlaceEvents(placeId, options) {
|
|
760
|
+
return this._get(`/luma/places/${placeId}/events`, {
|
|
761
|
+
params: { count: options?.count, cursor: options?.cursor }
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
async searchEvents(placeId, q, options) {
|
|
765
|
+
return this._get(`/luma/events/search`, {
|
|
766
|
+
params: {
|
|
767
|
+
place_id: placeId,
|
|
768
|
+
q,
|
|
769
|
+
count: options?.count,
|
|
770
|
+
cursor: options?.cursor
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
async getCategories() {
|
|
775
|
+
return this._get(`/luma/categories`);
|
|
776
|
+
}
|
|
777
|
+
async getCalendarEvents(calendarId, options) {
|
|
778
|
+
return this._get(`/luma/calendars/${calendarId}/events`, {
|
|
779
|
+
params: { count: options?.count, cursor: options?.cursor }
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
async getPlace(placeId) {
|
|
783
|
+
return this._get(`/luma/places/${placeId}`);
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
// src/platforms/producthunt.ts
|
|
788
|
+
var ProductHunt = class extends APIResource {
|
|
789
|
+
async getPosts(options) {
|
|
790
|
+
return this._get(`/producthunt/posts`, {
|
|
791
|
+
params: {
|
|
792
|
+
count: options?.count,
|
|
793
|
+
date: options?.date,
|
|
794
|
+
period: options?.period
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
async searchPosts(q, options) {
|
|
799
|
+
return this._get(`/producthunt/posts/search`, {
|
|
800
|
+
params: { q, count: options?.count }
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
async getPost(slug) {
|
|
804
|
+
return this._get(`/producthunt/posts/${slug}`);
|
|
805
|
+
}
|
|
806
|
+
async getReviews(slug) {
|
|
807
|
+
return this._get(`/producthunt/posts/${slug}/reviews`);
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
|
|
656
811
|
// src/platforms/ptt.ts
|
|
657
812
|
var PTT = class extends APIResource {
|
|
658
813
|
async getBoard(boardName) {
|
|
@@ -763,11 +918,25 @@ var Threads = class extends APIResource {
|
|
|
763
918
|
}
|
|
764
919
|
async searchPosts(q, options) {
|
|
765
920
|
return this._getList(`/threads/posts/search`, {
|
|
766
|
-
params: {
|
|
921
|
+
params: {
|
|
922
|
+
q,
|
|
923
|
+
count: options?.count,
|
|
924
|
+
search_type: options?.search_type,
|
|
925
|
+
cursor: options?.cursor
|
|
926
|
+
},
|
|
767
927
|
itemsKey: "posts",
|
|
768
928
|
castTo: (r) => r
|
|
769
929
|
});
|
|
770
930
|
}
|
|
931
|
+
/**
|
|
932
|
+
* Get direct replies to a Threads post.
|
|
933
|
+
*
|
|
934
|
+
* Returns `{rootPost, replies, totalReplies, hasMore}`. Anonymous SSR
|
|
935
|
+
* embeds ~20 top-level replies per post; pagination is not supported.
|
|
936
|
+
*/
|
|
937
|
+
async getPostReplies(postId) {
|
|
938
|
+
return this._get(`/threads/posts/${postId}/replies`);
|
|
939
|
+
}
|
|
771
940
|
async getUser(username) {
|
|
772
941
|
return this._get(`/threads/users/${username}`, {
|
|
773
942
|
castTo: (r) => r
|
|
@@ -792,42 +961,12 @@ var Threads = class extends APIResource {
|
|
|
792
961
|
}
|
|
793
962
|
async getPublicFeed(options) {
|
|
794
963
|
return this._get(`/threads/feed/public`, {
|
|
795
|
-
params: {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
async bulkSubmit(ids, options) {
|
|
800
|
-
return this._post(`/threads/bulk`, {
|
|
801
|
-
body: { ids, type: options?.type ?? "content" },
|
|
802
|
-
castTo: (r) => r
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
async bulkStatus(jobId) {
|
|
806
|
-
return this._get(`/threads/bulk/${jobId}`, {
|
|
807
|
-
castTo: (r) => r
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
async bulkResults(jobId) {
|
|
811
|
-
return this._request("GET", `/threads/bulk/${jobId}/results`);
|
|
812
|
-
}
|
|
813
|
-
async bulkSubmitAndWait(ids, options) {
|
|
814
|
-
const pollInterval = options?.pollInterval ?? 2e3;
|
|
815
|
-
const timeout = options?.timeout ?? 3e5;
|
|
816
|
-
const submitResp = await this.bulkSubmit(ids);
|
|
817
|
-
const jobId = submitResp.data.jobId;
|
|
818
|
-
const deadline = Date.now() + timeout;
|
|
819
|
-
while (Date.now() < deadline) {
|
|
820
|
-
const statusResp = await this.bulkStatus(jobId);
|
|
821
|
-
const status = statusResp.data.status;
|
|
822
|
-
if (status === "completed") {
|
|
823
|
-
return this.bulkResults(jobId);
|
|
824
|
-
}
|
|
825
|
-
if (status === "failed") {
|
|
826
|
-
throw new ByCrawlError(`Bulk job ${jobId} failed`);
|
|
964
|
+
params: {
|
|
965
|
+
cursor: options?.cursor,
|
|
966
|
+
count: options?.count,
|
|
967
|
+
country: options?.country
|
|
827
968
|
}
|
|
828
|
-
|
|
829
|
-
}
|
|
830
|
-
throw new TimeoutError(`Bulk job ${jobId} timed out after ${timeout}ms`);
|
|
969
|
+
});
|
|
831
970
|
}
|
|
832
971
|
// -- Auto-pagination iterators --
|
|
833
972
|
iterUserPosts(userId, options) {
|
|
@@ -868,11 +1007,6 @@ var TikTok = class extends APIResource {
|
|
|
868
1007
|
params: { cursor: options?.cursor }
|
|
869
1008
|
});
|
|
870
1009
|
}
|
|
871
|
-
async getCategories(options) {
|
|
872
|
-
return this._get(`/tiktok/categories`, {
|
|
873
|
-
params: { category: options?.category, count: options?.count }
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
1010
|
async search(q, options) {
|
|
877
1011
|
return this._get(`/tiktok/videos/search`, {
|
|
878
1012
|
params: { q, count: options?.count }
|
|
@@ -932,6 +1066,11 @@ var WebFetch = class extends APIResource {
|
|
|
932
1066
|
params: { url, format: options?.format }
|
|
933
1067
|
});
|
|
934
1068
|
}
|
|
1069
|
+
async search(q, options) {
|
|
1070
|
+
return this._get(`/web/search`, {
|
|
1071
|
+
params: { q, count: options?.count }
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
935
1074
|
};
|
|
936
1075
|
|
|
937
1076
|
// src/platforms/x.ts
|
|
@@ -1036,7 +1175,11 @@ var ByCrawl = class {
|
|
|
1036
1175
|
youtube;
|
|
1037
1176
|
dcard;
|
|
1038
1177
|
gmaps;
|
|
1178
|
+
google;
|
|
1179
|
+
hackernews;
|
|
1039
1180
|
job104;
|
|
1181
|
+
luma;
|
|
1182
|
+
producthunt;
|
|
1040
1183
|
trustpilot;
|
|
1041
1184
|
ptt;
|
|
1042
1185
|
rent591;
|
|
@@ -1065,7 +1208,11 @@ var ByCrawl = class {
|
|
|
1065
1208
|
this.youtube = new YouTube(this._transport);
|
|
1066
1209
|
this.dcard = new Dcard(this._transport);
|
|
1067
1210
|
this.gmaps = new GMaps(this._transport);
|
|
1211
|
+
this.google = new Google(this._transport);
|
|
1212
|
+
this.hackernews = new HackerNews(this._transport);
|
|
1068
1213
|
this.job104 = new Job104(this._transport);
|
|
1214
|
+
this.luma = new Luma(this._transport);
|
|
1215
|
+
this.producthunt = new ProductHunt(this._transport);
|
|
1069
1216
|
this.trustpilot = new Trustpilot(this._transport);
|
|
1070
1217
|
this.ptt = new PTT(this._transport);
|
|
1071
1218
|
this.rent591 = new Rent591(this._transport);
|