scavio 0.5.0 → 0.7.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 +119 -19
- package/dist/index.cjs +181 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +408 -4
- package/dist/index.d.ts +408 -4
- package/dist/index.js +181 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Scavio
|
|
2
2
|
|
|
3
|
-
TypeScript SDK for the [Scavio Search API](https://scavio.dev) — real-time Google, Amazon, Walmart, YouTube, Reddit, TikTok, and
|
|
3
|
+
TypeScript SDK for the [Scavio Search API](https://scavio.dev) — real-time Google, Amazon, Walmart, YouTube, Reddit, TikTok, Instagram, Twitter, and LinkedIn data.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -104,31 +104,128 @@ await client.walmart.product({
|
|
|
104
104
|
// Search videos
|
|
105
105
|
await client.youtube.search({
|
|
106
106
|
query: "typescript tutorial",
|
|
107
|
-
upload_date: "
|
|
108
|
-
sort_by: "relevance",
|
|
109
|
-
|
|
107
|
+
upload_date: "this_week", // optional
|
|
108
|
+
sort_by: "relevance", // optional
|
|
109
|
+
features: ["hd", "4k"], // optional
|
|
110
|
+
cursor: "...", // optional (pagination)
|
|
110
111
|
});
|
|
111
112
|
|
|
112
|
-
//
|
|
113
|
-
await client.youtube.
|
|
113
|
+
// Search Shorts
|
|
114
|
+
await client.youtube.shorts({ query: "cooking" });
|
|
115
|
+
|
|
116
|
+
// Search-as-you-type suggestions
|
|
117
|
+
await client.youtube.suggestions({ query: "how to" });
|
|
118
|
+
|
|
119
|
+
// Get video details (accepts an id or a full watch URL)
|
|
120
|
+
await client.youtube.video({ video_id: "dQw4w9WgXcQ" });
|
|
121
|
+
// youtube.metadata() is a deprecated alias of youtube.video()
|
|
122
|
+
|
|
123
|
+
// Video comments and threaded replies
|
|
124
|
+
await client.youtube.comments({ video_id: "dQw4w9WgXcQ" });
|
|
125
|
+
await client.youtube.commentReplies({
|
|
114
126
|
video_id: "dQw4w9WgXcQ",
|
|
127
|
+
reply_cursor: "...", // from a comment's reply_cursor
|
|
115
128
|
});
|
|
129
|
+
|
|
130
|
+
// Transcript / subtitles (format: 'text' or 'srt')
|
|
131
|
+
await client.youtube.transcript({ video_id: "dQw4w9WgXcQ", format: "srt" });
|
|
132
|
+
|
|
133
|
+
// Related videos
|
|
134
|
+
await client.youtube.related({ video_id: "dQw4w9WgXcQ" });
|
|
135
|
+
|
|
136
|
+
// Playable / downloadable stream URLs
|
|
137
|
+
await client.youtube.streams({ video_id: "dQw4w9WgXcQ" });
|
|
138
|
+
|
|
139
|
+
// Channels
|
|
140
|
+
await client.youtube.channelSearch({ query: "mkbhd" });
|
|
141
|
+
await client.youtube.channel({ channel_id: "@mkbhd" }); // id, @handle, or URL
|
|
142
|
+
await client.youtube.channelVideos({ channel_id: "UC..." });
|
|
143
|
+
await client.youtube.channelShorts({ channel_id: "UC..." });
|
|
144
|
+
await client.youtube.channelCommunity({ channel_id: "UC..." });
|
|
145
|
+
await client.youtube.channelResolve({ channel: "@mkbhd" }); // handle/URL -> id
|
|
116
146
|
```
|
|
117
147
|
|
|
118
148
|
### Reddit
|
|
119
149
|
|
|
120
150
|
```typescript
|
|
121
151
|
// Search posts
|
|
122
|
-
await client.reddit.search({
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
});
|
|
152
|
+
await client.reddit.search({ query: "typescript", cursor: "..." });
|
|
153
|
+
|
|
154
|
+
// Search-as-you-type suggestions
|
|
155
|
+
await client.reddit.searchSuggestions({ query: "python" });
|
|
127
156
|
|
|
128
|
-
//
|
|
129
|
-
await client.reddit.post({
|
|
130
|
-
|
|
157
|
+
// Post detail (by post_id or url)
|
|
158
|
+
await client.reddit.post({ post_id: "t3_1v6ngaf" });
|
|
159
|
+
await client.reddit.post({ url: "https://reddit.com/r/typescript/comments/abc123" });
|
|
160
|
+
|
|
161
|
+
// Post comments and threaded replies
|
|
162
|
+
await client.reddit.postComments({ post_id: "t3_1v6ngaf", sort: "TOP" });
|
|
163
|
+
await client.reddit.commentReplies({
|
|
164
|
+
post_id: "t3_1v6ngaf",
|
|
165
|
+
cursor: "...", // reply_cursor from a comment
|
|
131
166
|
});
|
|
167
|
+
|
|
168
|
+
// Subreddit info and feed
|
|
169
|
+
await client.reddit.subreddit({ subreddit: "AskReddit" });
|
|
170
|
+
await client.reddit.subredditPosts({ subreddit: "AskReddit", sort: "HOT" });
|
|
171
|
+
|
|
172
|
+
// Redditor profile, posts, and comments
|
|
173
|
+
await client.reddit.user({ username: "spez" });
|
|
174
|
+
await client.reddit.userPosts({ username: "spez", sort: "NEW" });
|
|
175
|
+
await client.reddit.userComments({ username: "spez" });
|
|
176
|
+
|
|
177
|
+
// Site-wide popular feed and trending searches
|
|
178
|
+
await client.reddit.popular();
|
|
179
|
+
await client.reddit.trending();
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Twitter
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
// Search tweets and people
|
|
186
|
+
await client.twitter.search({ search: "artificial intelligence", search_type: "Latest" });
|
|
187
|
+
|
|
188
|
+
// Tweet detail, comments, and retweeters
|
|
189
|
+
await client.twitter.tweet({ tweet_id: "1808168603721650364" });
|
|
190
|
+
await client.twitter.tweetComments({ tweet_id: "1808168603721650364", rank: "top" });
|
|
191
|
+
await client.twitter.tweetRetweeters({ tweet_id: "1808168603721650364" });
|
|
192
|
+
|
|
193
|
+
// User profile and feeds
|
|
194
|
+
await client.twitter.user({ screen_name: "elonmusk" });
|
|
195
|
+
await client.twitter.userTweets({ screen_name: "elonmusk" });
|
|
196
|
+
await client.twitter.userReplies({ screen_name: "elonmusk" });
|
|
197
|
+
await client.twitter.userMedia({ screen_name: "elonmusk" });
|
|
198
|
+
await client.twitter.userFollowers({ screen_name: "elonmusk" });
|
|
199
|
+
await client.twitter.userFollowings({ screen_name: "elonmusk" });
|
|
200
|
+
|
|
201
|
+
// Trending topics
|
|
202
|
+
await client.twitter.trending({ country: "UnitedStates" });
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### LinkedIn
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
// Person profile, about, posts, and contact
|
|
209
|
+
await client.linkedin.person({ username: "williamhgates" });
|
|
210
|
+
await client.linkedin.personAbout({ username: "williamhgates" });
|
|
211
|
+
await client.linkedin.personPosts({ username: "williamhgates" });
|
|
212
|
+
await client.linkedin.personContact({ username: "williamhgates" });
|
|
213
|
+
|
|
214
|
+
// Company profile, posts, people, and jobs
|
|
215
|
+
await client.linkedin.company({ company: "microsoft" });
|
|
216
|
+
await client.linkedin.companyPosts({ company: "microsoft" });
|
|
217
|
+
await client.linkedin.companyPeople({ company: "microsoft" });
|
|
218
|
+
await client.linkedin.companyJobs({ company: "microsoft" });
|
|
219
|
+
|
|
220
|
+
// Search people, jobs, and posts
|
|
221
|
+
await client.linkedin.searchPeople({ search: "john", title: "engineer" });
|
|
222
|
+
await client.linkedin.searchJobs({ search: "software engineer" });
|
|
223
|
+
await client.linkedin.searchPosts({ search: "AI agents" });
|
|
224
|
+
|
|
225
|
+
// Job, post, and post comments
|
|
226
|
+
await client.linkedin.job({ job_id: "3900000000" });
|
|
227
|
+
await client.linkedin.post({ post_id: "7486820977411145728" });
|
|
228
|
+
await client.linkedin.postComments({ post_id: "7486820977411145728", sort_order: "relevance" });
|
|
132
229
|
```
|
|
133
230
|
|
|
134
231
|
### TikTok
|
|
@@ -246,11 +343,14 @@ MIT
|
|
|
246
343
|
|
|
247
344
|
## About Scavio
|
|
248
345
|
|
|
249
|
-
[Scavio](https://scavio.dev) is a unified [search API](https://scavio.dev/
|
|
346
|
+
[Scavio](https://scavio.dev) is a unified [search API for AI agents](https://scavio.dev/search-api-for-ai-agents) — one API key, structured JSON, no scraping or proxies. A real-time [Tavily alternative](https://scavio.dev/alternatives/tavily) and [SerpAPI alternative](https://scavio.dev/alternatives/serpapi) with data from:
|
|
347
|
+
|
|
348
|
+
- [Google Search API](https://scavio.dev/google-search-api) — SERP results, news, images, maps, and knowledge graph
|
|
349
|
+
- [Amazon Product API](https://scavio.dev/amazon-product-api) and [Walmart Product API](https://scavio.dev/walmart-product-api) — product search and details
|
|
350
|
+
- [YouTube API](https://scavio.dev/youtube-transcript-api), [TikTok API](https://scavio.dev/tiktok-api), and [Instagram API](https://scavio.dev/instagram-api) — video and social media data
|
|
351
|
+
- [Reddit API](https://scavio.dev/reddit-api) — posts and threaded comments
|
|
352
|
+
- [Twitter API](https://scavio.dev/twitter-api) and [LinkedIn API](https://scavio.dev/linkedin-api) — tweets, profiles, companies, and jobs
|
|
250
353
|
|
|
251
|
-
|
|
252
|
-
- [Amazon Product API](https://scavio.dev/docs/amazon-api) and [Walmart API](https://scavio.dev/docs/walmart-api) — product search and details
|
|
253
|
-
- [YouTube API](https://scavio.dev/docs/youtube-api), [TikTok API](https://scavio.dev/docs/tiktok-api), and [Instagram API](https://scavio.dev/docs/instagram-api) — video and social media data
|
|
254
|
-
- [Reddit API](https://scavio.dev/docs/reddit-api) — posts and threaded comments
|
|
354
|
+
Teams choosing between providers can [compare Scavio vs alternatives](https://scavio.dev/compare) side by side.
|
|
255
355
|
|
|
256
356
|
Get a free [API key](https://dashboard.scavio.dev) and explore the [documentation](https://scavio.dev/docs/introduction).
|
package/dist/index.cjs
CHANGED
|
@@ -390,9 +390,39 @@ var RedditNamespace = class {
|
|
|
390
390
|
async search(options) {
|
|
391
391
|
return this.client._post("/api/v1/reddit/search", options);
|
|
392
392
|
}
|
|
393
|
+
async searchSuggestions(options) {
|
|
394
|
+
return this.client._post("/api/v1/reddit/search/suggestions", options);
|
|
395
|
+
}
|
|
393
396
|
async post(options) {
|
|
394
397
|
return this.client._post("/api/v1/reddit/post", options);
|
|
395
398
|
}
|
|
399
|
+
async postComments(options) {
|
|
400
|
+
return this.client._post("/api/v1/reddit/post/comments", options);
|
|
401
|
+
}
|
|
402
|
+
async commentReplies(options) {
|
|
403
|
+
return this.client._post("/api/v1/reddit/post/comments/replies", options);
|
|
404
|
+
}
|
|
405
|
+
async subreddit(options) {
|
|
406
|
+
return this.client._post("/api/v1/reddit/subreddit", options);
|
|
407
|
+
}
|
|
408
|
+
async subredditPosts(options) {
|
|
409
|
+
return this.client._post("/api/v1/reddit/subreddit/posts", options);
|
|
410
|
+
}
|
|
411
|
+
async user(options) {
|
|
412
|
+
return this.client._post("/api/v1/reddit/user", options);
|
|
413
|
+
}
|
|
414
|
+
async userPosts(options) {
|
|
415
|
+
return this.client._post("/api/v1/reddit/user/posts", options);
|
|
416
|
+
}
|
|
417
|
+
async userComments(options) {
|
|
418
|
+
return this.client._post("/api/v1/reddit/user/comments", options);
|
|
419
|
+
}
|
|
420
|
+
async popular(options = {}) {
|
|
421
|
+
return this.client._post("/api/v1/reddit/popular", options);
|
|
422
|
+
}
|
|
423
|
+
async trending() {
|
|
424
|
+
return this.client._post("/api/v1/reddit/trending", {});
|
|
425
|
+
}
|
|
396
426
|
};
|
|
397
427
|
|
|
398
428
|
// src/namespaces/tiktok.ts
|
|
@@ -511,8 +541,154 @@ var YouTubeNamespace = class {
|
|
|
511
541
|
if (video_3d !== void 0) body["3d"] = video_3d;
|
|
512
542
|
return this.client._post("/api/v1/youtube/search", body);
|
|
513
543
|
}
|
|
544
|
+
async shorts(options) {
|
|
545
|
+
const { query, ...rest } = options;
|
|
546
|
+
return this.client._post("/api/v1/youtube/shorts", {
|
|
547
|
+
search: query,
|
|
548
|
+
...rest
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
async suggestions(options) {
|
|
552
|
+
const { query, ...rest } = options;
|
|
553
|
+
return this.client._post("/api/v1/youtube/suggestions", {
|
|
554
|
+
search: query,
|
|
555
|
+
...rest
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
async video(options) {
|
|
559
|
+
return this.client._post("/api/v1/youtube/video", options);
|
|
560
|
+
}
|
|
561
|
+
/** @deprecated Use youtube.video(). Alias kept for backward compatibility. */
|
|
514
562
|
async metadata(options) {
|
|
515
|
-
return this.
|
|
563
|
+
return this.video(options);
|
|
564
|
+
}
|
|
565
|
+
async comments(options) {
|
|
566
|
+
return this.client._post("/api/v1/youtube/comments", options);
|
|
567
|
+
}
|
|
568
|
+
async commentReplies(options) {
|
|
569
|
+
return this.client._post("/api/v1/youtube/comments/replies", options);
|
|
570
|
+
}
|
|
571
|
+
async transcript(options) {
|
|
572
|
+
return this.client._post("/api/v1/youtube/transcript", options);
|
|
573
|
+
}
|
|
574
|
+
async related(options) {
|
|
575
|
+
return this.client._post("/api/v1/youtube/related", options);
|
|
576
|
+
}
|
|
577
|
+
async channelSearch(options) {
|
|
578
|
+
const { query, ...rest } = options;
|
|
579
|
+
return this.client._post("/api/v1/youtube/channel/search", {
|
|
580
|
+
search: query,
|
|
581
|
+
...rest
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
async channel(options) {
|
|
585
|
+
return this.client._post("/api/v1/youtube/channel", options);
|
|
586
|
+
}
|
|
587
|
+
async channelVideos(options) {
|
|
588
|
+
return this.client._post("/api/v1/youtube/channel/videos", options);
|
|
589
|
+
}
|
|
590
|
+
async channelShorts(options) {
|
|
591
|
+
return this.client._post("/api/v1/youtube/channel/shorts", options);
|
|
592
|
+
}
|
|
593
|
+
async channelCommunity(options) {
|
|
594
|
+
return this.client._post("/api/v1/youtube/channel/community", options);
|
|
595
|
+
}
|
|
596
|
+
async channelResolve(options) {
|
|
597
|
+
return this.client._post("/api/v1/youtube/channel/resolve", options);
|
|
598
|
+
}
|
|
599
|
+
async streams(options) {
|
|
600
|
+
return this.client._post("/api/v1/youtube/streams", options);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
// src/namespaces/twitter.ts
|
|
605
|
+
var TwitterNamespace = class {
|
|
606
|
+
constructor(client) {
|
|
607
|
+
this.client = client;
|
|
608
|
+
}
|
|
609
|
+
client;
|
|
610
|
+
async search(options) {
|
|
611
|
+
return this.client._post("/api/v1/twitter/search", options);
|
|
612
|
+
}
|
|
613
|
+
async tweet(options) {
|
|
614
|
+
return this.client._post("/api/v1/twitter/tweet", options);
|
|
615
|
+
}
|
|
616
|
+
async tweetComments(options) {
|
|
617
|
+
return this.client._post("/api/v1/twitter/tweet/comments", options);
|
|
618
|
+
}
|
|
619
|
+
async tweetRetweeters(options) {
|
|
620
|
+
return this.client._post("/api/v1/twitter/tweet/retweeters", options);
|
|
621
|
+
}
|
|
622
|
+
async user(options) {
|
|
623
|
+
return this.client._post("/api/v1/twitter/user", options);
|
|
624
|
+
}
|
|
625
|
+
async userTweets(options) {
|
|
626
|
+
return this.client._post("/api/v1/twitter/user/tweets", options);
|
|
627
|
+
}
|
|
628
|
+
async userReplies(options) {
|
|
629
|
+
return this.client._post("/api/v1/twitter/user/replies", options);
|
|
630
|
+
}
|
|
631
|
+
async userMedia(options) {
|
|
632
|
+
return this.client._post("/api/v1/twitter/user/media", options);
|
|
633
|
+
}
|
|
634
|
+
async userFollowers(options) {
|
|
635
|
+
return this.client._post("/api/v1/twitter/user/followers", options);
|
|
636
|
+
}
|
|
637
|
+
async userFollowings(options) {
|
|
638
|
+
return this.client._post("/api/v1/twitter/user/followings", options);
|
|
639
|
+
}
|
|
640
|
+
async trending(options = {}) {
|
|
641
|
+
return this.client._post("/api/v1/twitter/trending", options);
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
// src/namespaces/linkedin.ts
|
|
646
|
+
var LinkedInNamespace = class {
|
|
647
|
+
constructor(client) {
|
|
648
|
+
this.client = client;
|
|
649
|
+
}
|
|
650
|
+
client;
|
|
651
|
+
async person(options) {
|
|
652
|
+
return this.client._post("/api/v1/linkedin/person", options);
|
|
653
|
+
}
|
|
654
|
+
async personAbout(options) {
|
|
655
|
+
return this.client._post("/api/v1/linkedin/person/about", options);
|
|
656
|
+
}
|
|
657
|
+
async personPosts(options) {
|
|
658
|
+
return this.client._post("/api/v1/linkedin/person/posts", options);
|
|
659
|
+
}
|
|
660
|
+
async personContact(options) {
|
|
661
|
+
return this.client._post("/api/v1/linkedin/person/contact", options);
|
|
662
|
+
}
|
|
663
|
+
async company(options) {
|
|
664
|
+
return this.client._post("/api/v1/linkedin/company", options);
|
|
665
|
+
}
|
|
666
|
+
async companyPosts(options) {
|
|
667
|
+
return this.client._post("/api/v1/linkedin/company/posts", options);
|
|
668
|
+
}
|
|
669
|
+
async companyPeople(options) {
|
|
670
|
+
return this.client._post("/api/v1/linkedin/company/people", options);
|
|
671
|
+
}
|
|
672
|
+
async companyJobs(options) {
|
|
673
|
+
return this.client._post("/api/v1/linkedin/company/jobs", options);
|
|
674
|
+
}
|
|
675
|
+
async searchPeople(options) {
|
|
676
|
+
return this.client._post("/api/v1/linkedin/search/people", options);
|
|
677
|
+
}
|
|
678
|
+
async searchJobs(options) {
|
|
679
|
+
return this.client._post("/api/v1/linkedin/search/jobs", options);
|
|
680
|
+
}
|
|
681
|
+
async searchPosts(options) {
|
|
682
|
+
return this.client._post("/api/v1/linkedin/search/posts", options);
|
|
683
|
+
}
|
|
684
|
+
async job(options) {
|
|
685
|
+
return this.client._post("/api/v1/linkedin/job", options);
|
|
686
|
+
}
|
|
687
|
+
async post(options) {
|
|
688
|
+
return this.client._post("/api/v1/linkedin/post", options);
|
|
689
|
+
}
|
|
690
|
+
async postComments(options) {
|
|
691
|
+
return this.client._post("/api/v1/linkedin/post/comments", options);
|
|
516
692
|
}
|
|
517
693
|
};
|
|
518
694
|
|
|
@@ -525,6 +701,8 @@ var Scavio = class {
|
|
|
525
701
|
reddit;
|
|
526
702
|
tiktok;
|
|
527
703
|
instagram;
|
|
704
|
+
twitter;
|
|
705
|
+
linkedin;
|
|
528
706
|
apiKey;
|
|
529
707
|
baseUrl;
|
|
530
708
|
timeout;
|
|
@@ -550,6 +728,8 @@ var Scavio = class {
|
|
|
550
728
|
this.reddit = new RedditNamespace(this);
|
|
551
729
|
this.tiktok = new TikTokNamespace(this);
|
|
552
730
|
this.instagram = new InstagramNamespace(this);
|
|
731
|
+
this.twitter = new TwitterNamespace(this);
|
|
732
|
+
this.linkedin = new LinkedInNamespace(this);
|
|
553
733
|
}
|
|
554
734
|
/** @internal */
|
|
555
735
|
async _post(path, body) {
|