@getanyapi/sdk 0.35.3 → 0.37.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
@@ -897,9 +897,22 @@ var AnyAPI = class {
897
897
  );
898
898
  return mapCatalogList(raw);
899
899
  }
900
- /** Ranked catalog search. GET /catalog/search. Browse never accepts a query. */
900
+ /**
901
+ * Ranked catalog search. GET /catalog/search. Browse never accepts a query.
902
+ *
903
+ * The gateway needs at least one of query, category or platform, in any
904
+ * combination, so a scope with no query at all is a valid search. An absent or
905
+ * empty query omits `q` entirely, because an empty `q` is a different request.
906
+ */
901
907
  async search(options) {
902
- const search = new URLSearchParams({ q: options.query });
908
+ if (!options.query && !options.category && !options.platform) {
909
+ throw new AnyAPIError(
910
+ "search needs at least one of query, category, or platform",
911
+ 0
912
+ );
913
+ }
914
+ const search = new URLSearchParams();
915
+ if (options.query) search.set("q", options.query);
903
916
  if (options.category) search.set("category", options.category);
904
917
  if (options.platform) search.set("platform", options.platform);
905
918
  if (options.limit !== void 0) search.set("limit", String(options.limit));
@@ -3115,7 +3128,7 @@ var GoogleNamespace = class {
3115
3128
  *
3116
3129
  * Run a Google web search and get the organic results (title, link, snippet, position) as clean JSON. Returns about 10 results per call - Google stopped honoring bulk result counts in September 2025, so a limit above 10 is accepted but returns no more than a page. Pass the returned nextCursor back as cursor to walk further, or use google.search_100 for up to 100 ranked results in one call, which is cheaper past roughly 20 results.
3117
3130
  *
3118
- * Price: $0.00099 per request.
3131
+ * Price: $0.0009 per request.
3119
3132
  *
3120
3133
  * @example
3121
3134
  * const res = await client.google.search({ query: "best coffee maker", gl: "us", hl: "en", limit: 10 });
@@ -3616,7 +3629,7 @@ var InstagramNamespace = class {
3616
3629
  *
3617
3630
  * Fetch a single Instagram post or reel by URL (media URLs, like count, owner, type) as normalized JSON.
3618
3631
  *
3619
- * Price: $0.0009 per request.
3632
+ * Price: $0.0015 per request.
3620
3633
  *
3621
3634
  * @example
3622
3635
  * const res = await client.instagram.post({ url: "https://www.instagram.com/reel/DWzrfE2kaY8/" });
@@ -3629,7 +3642,7 @@ var InstagramNamespace = class {
3629
3642
  *
3630
3643
  * List the comments on an Instagram post or reel by URL with cursor pagination (text, author, likes).
3631
3644
  *
3632
- * Price: $0.0015 per request.
3645
+ * Price: $0.00144 per request.
3633
3646
  *
3634
3647
  * @example
3635
3648
  * const res = await client.instagram.postComments({ url: "https://www.instagram.com/reel/DWzrfE2kaY8/" });
@@ -3721,7 +3734,7 @@ var InstagramNamespace = class {
3721
3734
  /**
3722
3735
  * Instagram Hashtag Search
3723
3736
  *
3724
- * Search posts under an Instagram hashtag through a web search index rather than Instagram's own hashtag feed. That is what lets it filter by date and media type and return reels whose like counts have settled, and it is also why results skew older (median around three months) and stop at roughly 110 per hashtag. For Instagram's own live ranking of a tag use instagram.hashtag_top_posts, and for the chronological feed use instagram.hashtag_recent_posts.
3737
+ * Search posts under an Instagram hashtag through a web search index rather than Instagram's own hashtag feed. That is what lets it filter by date and media type and return reels whose like counts have settled, and it is also why results skew older (median around three months) and stop at roughly 110 per hashtag. If that web search index is unavailable, a first-page request that sets no date and no media type is served from Instagram's own live top feed instead. For Instagram's own live ranking of a tag use instagram.hashtag_top_posts, and for the chronological feed use instagram.hashtag_recent_posts.
3725
3738
  *
3726
3739
  * Price: $0.002 per request.
3727
3740
  *
@@ -4337,10 +4350,10 @@ var MapsNamespace = class {
4337
4350
  *
4338
4351
  * Fetch up to 100 Google Maps reviews for a place by place ID, sorted the way you need, in one normalized response.
4339
4352
  *
4340
- * Price: $0.00006 per request plus $0.00044 per result (maximum $0.0441).
4353
+ * Price: $0.0035 per request.
4341
4354
  *
4342
4355
  * @example
4343
- * const res = await client.maps.reviews({ placeId: "ChIJN1t_tDeuEmsRUsoyG83frY4", limit: 3, postedLimit: "year" });
4356
+ * const res = await client.maps.reviews({ placeId: "ChIJN1t_tDeuEmsRUsoyG83frY4", limit: 3 });
4344
4357
  */
4345
4358
  reviews(input, options) {
4346
4359
  return this._core.run("maps.reviews", input, options);
@@ -4617,7 +4630,7 @@ var PerplexityNamespace = class {
4617
4630
  *
4618
4631
  * Ask Perplexity a web-grounded question and receive an answer with source citations.
4619
4632
  *
4620
- * Price: $0.00006 per request plus $0.011 per result (maximum $0.0111).
4633
+ * Price: $0.0036 per request.
4621
4634
  *
4622
4635
  * @example
4623
4636
  * const res = await client.perplexity.search({ prompt: "What is AnyAPI at getanyapi.com, and what does it offer?" });
@@ -4859,7 +4872,7 @@ var RedditNamespace = class {
4859
4872
  *
4860
4873
  * Fetch a single Reddit post by URL, including its full body text, score, comment count, upvote ratio, and subreddit, as normalized JSON.
4861
4874
  *
4862
- * Price: $0.0009 per request.
4875
+ * Price: $0.0012 per request.
4863
4876
  *
4864
4877
  * @example
4865
4878
  * const res = await client.reddit.post({ url: "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/" });
@@ -4927,7 +4940,7 @@ var RedditNamespace = class {
4927
4940
  *
4928
4941
  * Search Reddit posts across all subreddits by query.
4929
4942
  *
4930
- * Price: $0.0009 per request.
4943
+ * Price: $0.0012 per request.
4931
4944
  *
4932
4945
  * @example
4933
4946
  * const res = await client.reddit.search({ query: "mechanical keyboard" });
@@ -6544,7 +6557,7 @@ var TripadvisorNamespace = class {
6544
6557
  *
6545
6558
  * Fetch the latest reviews for any Tripadvisor hotel, restaurant, or attraction by its page URL: rating, text, date, and trip details as normalized JSON.
6546
6559
  *
6547
- * Price: $0.0036 per request.
6560
+ * Price: $0.003 per request.
6548
6561
  *
6549
6562
  * @example
6550
6563
  * const res = await client.tripadvisor.reviews({ url: "https://www.tripadvisor.com/Hotel_Review-g60763-d93450-Reviews-The_Plaza-New_York_City_New_York.html", limit: 3 });
@@ -6557,7 +6570,7 @@ var TripadvisorNamespace = class {
6557
6570
  *
6558
6571
  * Search Tripadvisor for hotels, restaurants, and attractions in any destination and get rich place records (ratings, review counts, contact details, pricing) as normalized JSON.
6559
6572
  *
6560
- * Price: $0.0036 per request.
6573
+ * Price: $0.003 per request.
6561
6574
  *
6562
6575
  * @example
6563
6576
  * const res = await client.tripadvisor.search({ query: "Paris", limit: 3 });
@@ -7215,7 +7228,7 @@ var YelpNamespace = class {
7215
7228
  *
7216
7229
  * Search Yelp for businesses by keyword and location: up to 20 listings with ratings, categories, and core business info per request.
7217
7230
  *
7218
- * Price: $0.044 per request plus $0.00083 per result (maximum $0.0605).
7231
+ * Price: $0.0035 per request.
7219
7232
  *
7220
7233
  * @example
7221
7234
  * const res = await client.yelp.search({ location: "Chicago, IL", query: "pizza", limit: 5 });
@@ -7499,6 +7512,35 @@ var YoutubeNamespace = class {
7499
7512
  options
7500
7513
  );
7501
7514
  }
7515
+ /**
7516
+ * YouTube Shorts Search
7517
+ *
7518
+ * Search YouTube Shorts by keyword and get matching Shorts (title, views, URL) with cursor pagination as normalized JSON.
7519
+ *
7520
+ * Price: $0.002 per request.
7521
+ *
7522
+ * @example
7523
+ * const res = await client.youtube.searchShorts({ query: "cats" });
7524
+ */
7525
+ searchShorts(input, options) {
7526
+ return this._core.run("youtube.search_shorts", input, options);
7527
+ }
7528
+ /**
7529
+ * Iterate every result of YouTube Shorts Search across pages.
7530
+ *
7531
+ * Yields items directly; call `.pages()` on the return value to walk whole
7532
+ * result pages instead (each carries its own costUsd).
7533
+ */
7534
+ iterSearchShorts(input, options) {
7535
+ return paginate(
7536
+ this._core,
7537
+ "youtube.search_shorts",
7538
+ input,
7539
+ "shorts",
7540
+ false,
7541
+ options
7542
+ );
7543
+ }
7502
7544
  /**
7503
7545
  * YouTube Trending Shorts
7504
7546
  *
@@ -7515,7 +7557,7 @@ var YoutubeNamespace = class {
7515
7557
  /**
7516
7558
  * YouTube Video
7517
7559
  *
7518
- * Fetch a YouTube video's metadata (title, channel, views, likes, duration, publish date) by URL or ID.
7560
+ * Fetch a YouTube video or Short's metadata (title, channel, views, likes, duration, publish date) by URL or ID.
7519
7561
  *
7520
7562
  * Price: $0.00125 per request.
7521
7563
  *
@@ -7528,7 +7570,7 @@ var YoutubeNamespace = class {
7528
7570
  /**
7529
7571
  * YouTube Video Comments
7530
7572
  *
7531
- * List the comments on a YouTube video by URL with cursor pagination (text, author, likes, reply count).
7573
+ * List the comments on a YouTube video or Short by URL with cursor pagination (text, author, likes, reply count).
7532
7574
  *
7533
7575
  * Price: $0.002 per request.
7534
7576
  *
@@ -7570,7 +7612,7 @@ var YoutubeNamespace = class {
7570
7612
  /**
7571
7613
  * YouTube Video Transcript
7572
7614
  *
7573
- * Fetch the transcript/captions of a YouTube video by URL or ID.
7615
+ * Fetch the transcript/captions of a YouTube video or Short by URL or ID.
7574
7616
  *
7575
7617
  * Price: $0.00125 per request.
7576
7618
  *
@@ -7583,9 +7625,9 @@ var YoutubeNamespace = class {
7583
7625
  /**
7584
7626
  * YouTube Video Transcript (Provenance)
7585
7627
  *
7586
- * Fetch a YouTube transcript with timed segments and its provenance: whether the words are creator-written captions or machine speech recognition.
7628
+ * Fetch a YouTube video or Short transcript with timed segments and its provenance: whether the words are creator-written captions or machine speech recognition.
7587
7629
  *
7588
- * Price: $0.00308 per request plus $0 per result (maximum $0.00308).
7630
+ * Price: $0.001 per request.
7589
7631
  *
7590
7632
  * @example
7591
7633
  * const res = await client.youtube.videoTranscriptFull({ url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" });