scavio 0.21.1 → 0.22.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/README.md CHANGED
@@ -356,7 +356,7 @@ nickname, or a listing with no public questions, is a billed 404.
356
356
 
357
357
  ### YouTube
358
358
 
359
- Credit cost varies by endpoint: `transcript` costs 8; `streams` costs 3;
359
+ Credit cost varies by endpoint: `transcript` costs 5; `streams` costs 3;
360
360
  `search` and `shorts` cost 2; every other YouTube endpoint costs 1.
361
361
 
362
362
  ```typescript
@@ -402,6 +402,10 @@ await client.youtube.channelVideos({ channel_id: "UC..." });
402
402
  await client.youtube.channelShorts({ channel_id: "UC..." });
403
403
  await client.youtube.channelCommunity({ channel_id: "UC..." });
404
404
  await client.youtube.channelResolve({ channel: "@mkbhd" }); // handle/URL -> id
405
+
406
+ // One community post (text, author, likes, images, comments_cursor) and its comments
407
+ await client.youtube.communityPost({ post_id: "Ugkx_PqHZYEoCCP7e8WIOrh-1HCvtKoFMzVp" });
408
+ await client.youtube.communityPostComments({ post_id: "Ugkx_PqHZYEoCCP7e8WIOrh-1HCvtKoFMzVp" });
405
409
  ```
406
410
 
407
411
  ### Reddit
@@ -409,7 +413,8 @@ await client.youtube.channelResolve({ channel: "@mkbhd" }); // handle/URL -> id
409
413
  Every Reddit endpoint costs 1 credit.
410
414
 
411
415
  `search()` takes only `query` and `cursor` — there is no result-type or sort
412
- filter, so anything else is dropped server-side. It returns
416
+ filter, so anything else is dropped server-side. `searchComments()` does sort
417
+ (`RELEVANCE`, `HOT`, `TOP` or `NEW`). It returns
413
418
  `data.results` with `next_cursor` and `has_more`. `post()` returns a flat post
414
419
  object under `data` and carries no comments; use `postComments()` for those.
415
420
  The subreddit and user feeds return `data.posts`.
@@ -444,6 +449,10 @@ await client.reddit.userComments({ username: "spez" });
444
449
  // Site-wide popular feed and trending searches
445
450
  await client.reddit.popular();
446
451
  await client.reddit.trending();
452
+
453
+ // Comment search (each result carries its post and subreddit) and subreddit search
454
+ await client.reddit.searchComments({ query: "web scraping api", sort: "NEW" });
455
+ await client.reddit.searchSubreddits({ query: "web scraping" });
447
456
  ```
448
457
 
449
458
  ### X
@@ -467,8 +476,15 @@ await client.x.userFollowings({ screen_name: "elonmusk" });
467
476
 
468
477
  // Trending topics
469
478
  await client.x.trending({ country: "UnitedStates" });
479
+
480
+ // Communities: search, details (rules, member count), and posts
481
+ await client.x.searchCommunities({ keyword: "crypto" });
482
+ await client.x.community({ community_id: "1508567430188126209" });
483
+ await client.x.communityTweets({ community_id: "1508567430188126209", ranking: "Recency" });
470
484
  ```
471
485
 
486
+ Every X endpoint costs 1 credit.
487
+
472
488
  ### LinkedIn
473
489
 
474
490
  ```typescript
@@ -541,8 +557,39 @@ await client.tiktok.userFollowers({ sec_user_id: "abc123" });
541
557
 
542
558
  // User followings
543
559
  await client.tiktok.userFollowings({ sec_user_id: "abc123" });
560
+
561
+ // Trending searches and a sample of trending videos (about 6 per call)
562
+ await client.tiktok.trendingSearches();
563
+ await client.tiktok.trendingVideos();
564
+
565
+ // Search autocomplete
566
+ await client.tiktok.searchSuggestions({ keyword: "cooking" });
567
+
568
+ // Sounds: detail, videos using a sound, search, Top 50 / Viral 50 chart
569
+ await client.tiktok.music({ music_id: "7364498342501435408" });
570
+ await client.tiktok.musicVideos({ music_id: "7364498342501435408" });
571
+ await client.tiktok.searchMusic({ keyword: "espresso" });
572
+ await client.tiktok.musicChart({ chart: "viral" });
573
+
574
+ // Similar creators, playlists and the videos in one
575
+ await client.tiktok.userSimilar({ sec_user_id: "abc123" });
576
+ await client.tiktok.userPlaylists({ sec_user_id: "abc123" });
577
+ await client.tiktok.playlistVideos({ playlist_id: "7596415294902389534" });
578
+
579
+ // Live status and account region (region also returns sec_user_id)
580
+ await client.tiktok.userLive({ username: "mrbeast" });
581
+ await client.tiktok.userRegion({ username: "mrbeast" });
544
582
  ```
545
583
 
584
+ Every TikTok endpoint costs 1 credit. The trending, sound, similar, playlist,
585
+ live and region endpoints return TikTok's raw payload: large numeric ids can
586
+ lose precision when parsed as JSON numbers, so use the string forms (`id_str`,
587
+ `sec_uid`, `sec_user_id`). `trendingVideos()` returns about 6 videos per call
588
+ whatever `count` is set to, and `musicVideos()` ignores `count` (about 14 per
589
+ page). Search suggestions can be empty for long-tail keywords and still bill.
590
+ An unknown username is a billed 404 on `userLive()` and an unbilled 404 on
591
+ `userRegion()`.
592
+
546
593
  ### TikTok Shop
547
594
 
548
595
  Every TikTok Shop endpoint costs 1 credit. Two limits to design around:
package/dist/index.cjs CHANGED
@@ -203,7 +203,7 @@ function parseRetryAfter(header) {
203
203
  var BASE_URL = "https://api.scavio.dev";
204
204
  var DEFAULT_TIMEOUT = 3e4;
205
205
  var DEFAULT_MAX_RETRIES = 2;
206
- var SDK_VERSION = true ? "0.21.1" : "0.0.0";
206
+ var SDK_VERSION = true ? "0.22.0" : "0.0.0";
207
207
  var USER_AGENT = `scavio-js/${SDK_VERSION}`;
208
208
  function isServerRuntime() {
209
209
  const g = globalThis;
@@ -493,6 +493,21 @@ var RedditNamespace = class {
493
493
  async trending() {
494
494
  return this.client._post("/api/v1/reddit/trending", {});
495
495
  }
496
+ /**
497
+ * Search Reddit comments by keyword. Each result carries the comment text,
498
+ * author, score and date, plus the post and subreddit it was left on.
499
+ * Costs 1 credit.
500
+ */
501
+ async searchComments(options) {
502
+ return this.client._post("/api/v1/reddit/search/comments", options);
503
+ }
504
+ /**
505
+ * Find subreddits by keyword, with subscriber counts, descriptions and NSFW
506
+ * flags. Costs 1 credit.
507
+ */
508
+ async searchSubreddits(options) {
509
+ return this.client._post("/api/v1/reddit/search/subreddits", options);
510
+ }
496
511
  };
497
512
 
498
513
  // src/namespaces/tiktok.ts
@@ -534,6 +549,107 @@ var TikTokNamespace = class {
534
549
  async userFollowings(options) {
535
550
  return this.client._post("/api/v1/tiktok/user/followings", options);
536
551
  }
552
+ /**
553
+ * Search terms trending on TikTok now (about 90 per call, US-weighted, no
554
+ * region filter). Costs 1 credit.
555
+ */
556
+ async trendingSearches() {
557
+ return this.client._post("/api/v1/tiktok/trending/searches", {});
558
+ }
559
+ /**
560
+ * A sample of videos trending on TikTok now, with author, stats, sound and
561
+ * hashtags. Each call returns about 6 videos whatever `count` is set to;
562
+ * call again for a fresh sample. No region filter. Costs 1 credit.
563
+ * Returns TikTok's raw payload: large numeric ids can lose precision as JSON
564
+ * numbers, so use the string forms (`id_str`, `sec_uid`).
565
+ */
566
+ async trendingVideos(options = {}) {
567
+ return this.client._post("/api/v1/tiktok/trending/videos", options);
568
+ }
569
+ /**
570
+ * TikTok search autocomplete suggestions for a keyword. Long-tail keywords
571
+ * can return none, which is still a billed answer. Costs 1 credit.
572
+ */
573
+ async searchSuggestions(options) {
574
+ return this.client._post("/api/v1/tiktok/search/suggestions", options);
575
+ }
576
+ /**
577
+ * A TikTok sound by id: title, artist, album, duration, how many videos use
578
+ * it, original vs commercial, play URL, cover, and chart rank when charting.
579
+ * Costs 1 credit.
580
+ * Returns TikTok's raw payload: large numeric ids can lose precision as JSON
581
+ * numbers, so use the string forms (`id_str`, `sec_uid`).
582
+ */
583
+ async music(options) {
584
+ return this.client._post("/api/v1/tiktok/music", options);
585
+ }
586
+ /**
587
+ * Videos that use a TikTok sound, about 14 per page (`count` is ignored
588
+ * upstream). Costs 1 credit.
589
+ * Returns TikTok's raw payload: large numeric ids can lose precision as JSON
590
+ * numbers, so use the string forms (`id_str`, `sec_uid`).
591
+ */
592
+ async musicVideos(options) {
593
+ return this.client._post("/api/v1/tiktok/music/videos", options);
594
+ }
595
+ /**
596
+ * Search TikTok sounds by keyword: id, title, artist, duration, usage count
597
+ * and play URL. Costs 1 credit.
598
+ * Returns TikTok's raw payload: large numeric ids can lose precision as JSON
599
+ * numbers, so use the string forms (`id_str`, `sec_uid`).
600
+ */
601
+ async searchMusic(options) {
602
+ return this.client._post("/api/v1/tiktok/search/music", options);
603
+ }
604
+ /**
605
+ * TikTok's Top 50 or Viral 50 sound chart, with each sound's details and
606
+ * trend. One global chart, no region filter. Costs 1 credit.
607
+ * Returns TikTok's raw payload: large numeric ids can lose precision as JSON
608
+ * numbers, so use the string forms (`id_str`, `sec_uid`).
609
+ */
610
+ async musicChart(options = {}) {
611
+ return this.client._post("/api/v1/tiktok/music/chart", options);
612
+ }
613
+ /**
614
+ * Creators similar to a TikTok user (about 30 per page), with follower,
615
+ * following, video and like counts, bio and verification. Costs 1 credit.
616
+ * Returns TikTok's raw payload: large numeric ids can lose precision as JSON
617
+ * numbers, so use the string forms (`id_str`, `sec_uid`).
618
+ */
619
+ async userSimilar(options) {
620
+ return this.client._post("/api/v1/tiktok/user/similar", options);
621
+ }
622
+ /**
623
+ * A TikTok user's playlists (series): id, name, video count and cover.
624
+ * Accounts without playlists return an empty list. Costs 1 credit.
625
+ */
626
+ async userPlaylists(options) {
627
+ return this.client._post("/api/v1/tiktok/user/playlists", options);
628
+ }
629
+ /**
630
+ * Videos in a TikTok playlist, with pagination. Costs 1 credit.
631
+ * Returns TikTok's raw payload: large numeric ids can lose precision as JSON
632
+ * numbers, so use the string forms (`id_str`, `sec_uid`).
633
+ */
634
+ async playlistVideos(options) {
635
+ return this.client._post("/api/v1/tiktok/playlist/videos", options);
636
+ }
637
+ /**
638
+ * Whether a TikTok user is live now: the user, live room status (2 = live,
639
+ * 4 = not live), title, start time and viewer counts. An unknown username is
640
+ * a billed 404. Costs 1 credit.
641
+ */
642
+ async userLive(options) {
643
+ return this.client._post("/api/v1/tiktok/user/live", options);
644
+ }
645
+ /**
646
+ * The region a TikTok account is registered in (ISO country code, not the
647
+ * creator's nationality), plus its user id and sec_user_id. An unknown
648
+ * username is a 404 and is not billed. Costs 1 credit.
649
+ */
650
+ async userRegion(options) {
651
+ return this.client._post("/api/v1/tiktok/user/region", options);
652
+ }
537
653
  };
538
654
 
539
655
  // src/namespaces/tiktok-shop.ts
@@ -826,6 +942,7 @@ var YouTubeNamespace = class {
826
942
  async commentReplies(options) {
827
943
  return this.client._post("/api/v1/youtube/comments/replies", options);
828
944
  }
945
+ /** Transcript / captions for a YouTube video. Costs 5 credits. */
829
946
  async transcript(options) {
830
947
  return this.client._post("/api/v1/youtube/transcript", options);
831
948
  }
@@ -857,6 +974,21 @@ var YouTubeNamespace = class {
857
974
  async streams(options) {
858
975
  return this.client._post("/api/v1/youtube/streams", options);
859
976
  }
977
+ /**
978
+ * A single YouTube community post: text, author, likes, comment count,
979
+ * attached images, and a comments_cursor for communityPostComments.
980
+ * Costs 1 credit.
981
+ */
982
+ async communityPost(options) {
983
+ return this.client._post("/api/v1/youtube/community/post", options);
984
+ }
985
+ /**
986
+ * Comments on a YouTube community post, with likes, reply counts and
987
+ * pagination. Costs 1 credit.
988
+ */
989
+ async communityPostComments(options) {
990
+ return this.client._post("/api/v1/youtube/community/post/comments", options);
991
+ }
860
992
  };
861
993
 
862
994
  // src/namespaces/x.ts
@@ -898,6 +1030,27 @@ var XNamespace = class {
898
1030
  async trending(options = {}) {
899
1031
  return this.client._post("/api/v1/x/trending", options);
900
1032
  }
1033
+ /**
1034
+ * Find X Communities by keyword, with member counts, topic and NSFW flag.
1035
+ * Costs 1 credit.
1036
+ */
1037
+ async searchCommunities(options) {
1038
+ return this.client._post("/api/v1/x/search/communities", options);
1039
+ }
1040
+ /**
1041
+ * An X Community: name, description, creation date, member count, topic and
1042
+ * rules. Costs 1 credit.
1043
+ */
1044
+ async community(options) {
1045
+ return this.client._post("/api/v1/x/community", options);
1046
+ }
1047
+ /**
1048
+ * Posts in an X Community, by relevance or recency, with pagination.
1049
+ * Costs 1 credit.
1050
+ */
1051
+ async communityTweets(options) {
1052
+ return this.client._post("/api/v1/x/community/tweets", options);
1053
+ }
901
1054
  };
902
1055
 
903
1056
  // src/namespaces/linkedin.ts