@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 CHANGED
@@ -543,6 +543,82 @@ var GMaps = class extends APIResource {
543
543
  castTo: (r) => r
544
544
  });
545
545
  }
546
+ async getPlaceReviews(query, options) {
547
+ return this._get(`/gmaps/places/reviews`, {
548
+ params: {
549
+ query,
550
+ sort: options?.sort,
551
+ pageToken: options?.pageToken,
552
+ language: options?.language
553
+ }
554
+ });
555
+ }
556
+ };
557
+
558
+ // src/platforms/google.ts
559
+ var Google = class extends APIResource {
560
+ async search(q, options) {
561
+ return this._get(`/google/search`, {
562
+ params: {
563
+ q,
564
+ num: options?.num,
565
+ language: options?.language,
566
+ country: options?.country,
567
+ page: options?.page
568
+ }
569
+ });
570
+ }
571
+ async news(q, options) {
572
+ return this._get(`/google/news`, {
573
+ params: { q, language: options?.language, country: options?.country }
574
+ });
575
+ }
576
+ async trends(q, options) {
577
+ return this._get(`/google/trends`, {
578
+ params: {
579
+ q,
580
+ timeframe: options?.timeframe,
581
+ geo: options?.geo,
582
+ category: options?.category
583
+ }
584
+ });
585
+ }
586
+ async finance(ticker) {
587
+ return this._get(`/google/finance`, {
588
+ params: { ticker }
589
+ });
590
+ }
591
+ async shopping(q, options) {
592
+ return this._get(`/google/shopping`, {
593
+ params: {
594
+ q,
595
+ num: options?.num,
596
+ min_price: options?.min_price,
597
+ max_price: options?.max_price,
598
+ country: options?.country
599
+ }
600
+ });
601
+ }
602
+ };
603
+
604
+ // src/platforms/hackernews.ts
605
+ var HackerNews = class extends APIResource {
606
+ async getItem(itemId) {
607
+ return this._get(`/hackernews/items/${itemId}`);
608
+ }
609
+ async getUser(username) {
610
+ return this._get(`/hackernews/users/${username}`);
611
+ }
612
+ async getStories(storyType, options) {
613
+ return this._get(`/hackernews/stories/${storyType}`, {
614
+ params: { count: options?.count }
615
+ });
616
+ }
617
+ async getItemComments(itemId, options) {
618
+ return this._get(`/hackernews/items/${itemId}/comments`, {
619
+ params: { depth: options?.depth }
620
+ });
621
+ }
546
622
  };
547
623
 
548
624
  // src/platforms/instagram.ts
@@ -626,6 +702,11 @@ var Job104 = class extends APIResource {
626
702
 
627
703
  // src/platforms/linkedin.ts
628
704
  var LinkedIn = class extends APIResource {
705
+ async searchCompanies(q, options) {
706
+ return this._get(`/linkedin/companies/search`, {
707
+ params: { q, count: options?.count }
708
+ });
709
+ }
629
710
  async getCompany(companyId) {
630
711
  return this._get(`/linkedin/companies/${companyId}`, {
631
712
  castTo: (r) => r
@@ -636,6 +717,11 @@ var LinkedIn = class extends APIResource {
636
717
  params: { count: options?.count, offset: options?.offset }
637
718
  });
638
719
  }
720
+ async getCompanyPosts(companyId, options) {
721
+ return this._get(`/linkedin/companies/${companyId}/posts`, {
722
+ params: { count: options?.count }
723
+ });
724
+ }
639
725
  async searchJobs(q, options) {
640
726
  return this._getList(`/linkedin/jobs/search`, {
641
727
  params: {
@@ -670,6 +756,18 @@ var LinkedIn = class extends APIResource {
670
756
  castTo: (r) => r
671
757
  });
672
758
  }
759
+ async getCompanyEmployees(companyId, options) {
760
+ return this._get(`/linkedin/companies/${companyId}/employees`, {
761
+ params: { count: options?.count ?? 25 }
762
+ });
763
+ }
764
+ async getUserPosts(username, options) {
765
+ return this._getList(`/linkedin/users/${username}/posts`, {
766
+ params: { count: options?.count ?? 20 },
767
+ itemsKey: "posts",
768
+ castTo: (r) => r
769
+ });
770
+ }
673
771
  // -- Auto-pagination iterators --
674
772
  iterCompanyJobs(companyId, options) {
675
773
  const count = options?.count ?? 10;
@@ -689,6 +787,63 @@ var LinkedIn = class extends APIResource {
689
787
  }
690
788
  };
691
789
 
790
+ // src/platforms/luma.ts
791
+ var Luma = class extends APIResource {
792
+ async getEvent(eventId) {
793
+ return this._get(`/luma/events/${eventId}`);
794
+ }
795
+ async getPlaceEvents(placeId, options) {
796
+ return this._get(`/luma/places/${placeId}/events`, {
797
+ params: { count: options?.count, cursor: options?.cursor }
798
+ });
799
+ }
800
+ async searchEvents(placeId, q, options) {
801
+ return this._get(`/luma/events/search`, {
802
+ params: {
803
+ place_id: placeId,
804
+ q,
805
+ count: options?.count,
806
+ cursor: options?.cursor
807
+ }
808
+ });
809
+ }
810
+ async getCategories() {
811
+ return this._get(`/luma/categories`);
812
+ }
813
+ async getCalendarEvents(calendarId, options) {
814
+ return this._get(`/luma/calendars/${calendarId}/events`, {
815
+ params: { count: options?.count, cursor: options?.cursor }
816
+ });
817
+ }
818
+ async getPlace(placeId) {
819
+ return this._get(`/luma/places/${placeId}`);
820
+ }
821
+ };
822
+
823
+ // src/platforms/producthunt.ts
824
+ var ProductHunt = class extends APIResource {
825
+ async getPosts(options) {
826
+ return this._get(`/producthunt/posts`, {
827
+ params: {
828
+ count: options?.count,
829
+ date: options?.date,
830
+ period: options?.period
831
+ }
832
+ });
833
+ }
834
+ async searchPosts(q, options) {
835
+ return this._get(`/producthunt/posts/search`, {
836
+ params: { q, count: options?.count }
837
+ });
838
+ }
839
+ async getPost(slug) {
840
+ return this._get(`/producthunt/posts/${slug}`);
841
+ }
842
+ async getReviews(slug) {
843
+ return this._get(`/producthunt/posts/${slug}/reviews`);
844
+ }
845
+ };
846
+
692
847
  // src/platforms/ptt.ts
693
848
  var PTT = class extends APIResource {
694
849
  async getBoard(boardName) {
@@ -799,11 +954,25 @@ var Threads = class extends APIResource {
799
954
  }
800
955
  async searchPosts(q, options) {
801
956
  return this._getList(`/threads/posts/search`, {
802
- params: { q, count: options?.count },
957
+ params: {
958
+ q,
959
+ count: options?.count,
960
+ search_type: options?.search_type,
961
+ cursor: options?.cursor
962
+ },
803
963
  itemsKey: "posts",
804
964
  castTo: (r) => r
805
965
  });
806
966
  }
967
+ /**
968
+ * Get direct replies to a Threads post.
969
+ *
970
+ * Returns `{rootPost, replies, totalReplies, hasMore}`. Anonymous SSR
971
+ * embeds ~20 top-level replies per post; pagination is not supported.
972
+ */
973
+ async getPostReplies(postId) {
974
+ return this._get(`/threads/posts/${postId}/replies`);
975
+ }
807
976
  async getUser(username) {
808
977
  return this._get(`/threads/users/${username}`, {
809
978
  castTo: (r) => r
@@ -828,42 +997,12 @@ var Threads = class extends APIResource {
828
997
  }
829
998
  async getPublicFeed(options) {
830
999
  return this._get(`/threads/feed/public`, {
831
- params: { cursor: options?.cursor, count: options?.count }
832
- });
833
- }
834
- // -- Bulk operations --
835
- async bulkSubmit(ids, options) {
836
- return this._post(`/threads/bulk`, {
837
- body: { ids, type: options?.type ?? "content" },
838
- castTo: (r) => r
839
- });
840
- }
841
- async bulkStatus(jobId) {
842
- return this._get(`/threads/bulk/${jobId}`, {
843
- castTo: (r) => r
844
- });
845
- }
846
- async bulkResults(jobId) {
847
- return this._request("GET", `/threads/bulk/${jobId}/results`);
848
- }
849
- async bulkSubmitAndWait(ids, options) {
850
- const pollInterval = options?.pollInterval ?? 2e3;
851
- const timeout = options?.timeout ?? 3e5;
852
- const submitResp = await this.bulkSubmit(ids);
853
- const jobId = submitResp.data.jobId;
854
- const deadline = Date.now() + timeout;
855
- while (Date.now() < deadline) {
856
- const statusResp = await this.bulkStatus(jobId);
857
- const status = statusResp.data.status;
858
- if (status === "completed") {
859
- return this.bulkResults(jobId);
860
- }
861
- if (status === "failed") {
862
- throw new ByCrawlError(`Bulk job ${jobId} failed`);
1000
+ params: {
1001
+ cursor: options?.cursor,
1002
+ count: options?.count,
1003
+ country: options?.country
863
1004
  }
864
- await new Promise((resolve) => setTimeout(resolve, pollInterval));
865
- }
866
- throw new TimeoutError(`Bulk job ${jobId} timed out after ${timeout}ms`);
1005
+ });
867
1006
  }
868
1007
  // -- Auto-pagination iterators --
869
1008
  iterUserPosts(userId, options) {
@@ -904,11 +1043,6 @@ var TikTok = class extends APIResource {
904
1043
  params: { cursor: options?.cursor }
905
1044
  });
906
1045
  }
907
- async getCategories(options) {
908
- return this._get(`/tiktok/categories`, {
909
- params: { category: options?.category, count: options?.count }
910
- });
911
- }
912
1046
  async search(q, options) {
913
1047
  return this._get(`/tiktok/videos/search`, {
914
1048
  params: { q, count: options?.count }
@@ -968,6 +1102,11 @@ var WebFetch = class extends APIResource {
968
1102
  params: { url, format: options?.format }
969
1103
  });
970
1104
  }
1105
+ async search(q, options) {
1106
+ return this._get(`/web/search`, {
1107
+ params: { q, count: options?.count }
1108
+ });
1109
+ }
971
1110
  };
972
1111
 
973
1112
  // src/platforms/x.ts
@@ -1072,7 +1211,11 @@ var ByCrawl = class {
1072
1211
  youtube;
1073
1212
  dcard;
1074
1213
  gmaps;
1214
+ google;
1215
+ hackernews;
1075
1216
  job104;
1217
+ luma;
1218
+ producthunt;
1076
1219
  trustpilot;
1077
1220
  ptt;
1078
1221
  rent591;
@@ -1101,7 +1244,11 @@ var ByCrawl = class {
1101
1244
  this.youtube = new YouTube(this._transport);
1102
1245
  this.dcard = new Dcard(this._transport);
1103
1246
  this.gmaps = new GMaps(this._transport);
1247
+ this.google = new Google(this._transport);
1248
+ this.hackernews = new HackerNews(this._transport);
1104
1249
  this.job104 = new Job104(this._transport);
1250
+ this.luma = new Luma(this._transport);
1251
+ this.producthunt = new ProductHunt(this._transport);
1105
1252
  this.trustpilot = new Trustpilot(this._transport);
1106
1253
  this.ptt = new PTT(this._transport);
1107
1254
  this.rent591 = new Rent591(this._transport);