@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.js CHANGED
@@ -782,9 +782,22 @@ var AnyAPI = class {
782
782
  );
783
783
  return mapCatalogList(raw);
784
784
  }
785
- /** Ranked catalog search. GET /catalog/search. Browse never accepts a query. */
785
+ /**
786
+ * Ranked catalog search. GET /catalog/search. Browse never accepts a query.
787
+ *
788
+ * The gateway needs at least one of query, category or platform, in any
789
+ * combination, so a scope with no query at all is a valid search. An absent or
790
+ * empty query omits `q` entirely, because an empty `q` is a different request.
791
+ */
786
792
  async search(options) {
787
- const search = new URLSearchParams({ q: options.query });
793
+ if (!options.query && !options.category && !options.platform) {
794
+ throw new AnyAPIError(
795
+ "search needs at least one of query, category, or platform",
796
+ 0
797
+ );
798
+ }
799
+ const search = new URLSearchParams();
800
+ if (options.query) search.set("q", options.query);
788
801
  if (options.category) search.set("category", options.category);
789
802
  if (options.platform) search.set("platform", options.platform);
790
803
  if (options.limit !== void 0) search.set("limit", String(options.limit));
@@ -3000,7 +3013,7 @@ var GoogleNamespace = class {
3000
3013
  *
3001
3014
  * 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.
3002
3015
  *
3003
- * Price: $0.00099 per request.
3016
+ * Price: $0.0009 per request.
3004
3017
  *
3005
3018
  * @example
3006
3019
  * const res = await client.google.search({ query: "best coffee maker", gl: "us", hl: "en", limit: 10 });
@@ -3501,7 +3514,7 @@ var InstagramNamespace = class {
3501
3514
  *
3502
3515
  * Fetch a single Instagram post or reel by URL (media URLs, like count, owner, type) as normalized JSON.
3503
3516
  *
3504
- * Price: $0.0009 per request.
3517
+ * Price: $0.0015 per request.
3505
3518
  *
3506
3519
  * @example
3507
3520
  * const res = await client.instagram.post({ url: "https://www.instagram.com/reel/DWzrfE2kaY8/" });
@@ -3514,7 +3527,7 @@ var InstagramNamespace = class {
3514
3527
  *
3515
3528
  * List the comments on an Instagram post or reel by URL with cursor pagination (text, author, likes).
3516
3529
  *
3517
- * Price: $0.0015 per request.
3530
+ * Price: $0.00144 per request.
3518
3531
  *
3519
3532
  * @example
3520
3533
  * const res = await client.instagram.postComments({ url: "https://www.instagram.com/reel/DWzrfE2kaY8/" });
@@ -3606,7 +3619,7 @@ var InstagramNamespace = class {
3606
3619
  /**
3607
3620
  * Instagram Hashtag Search
3608
3621
  *
3609
- * 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.
3622
+ * 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.
3610
3623
  *
3611
3624
  * Price: $0.002 per request.
3612
3625
  *
@@ -4222,10 +4235,10 @@ var MapsNamespace = class {
4222
4235
  *
4223
4236
  * Fetch up to 100 Google Maps reviews for a place by place ID, sorted the way you need, in one normalized response.
4224
4237
  *
4225
- * Price: $0.00006 per request plus $0.00044 per result (maximum $0.0441).
4238
+ * Price: $0.0035 per request.
4226
4239
  *
4227
4240
  * @example
4228
- * const res = await client.maps.reviews({ placeId: "ChIJN1t_tDeuEmsRUsoyG83frY4", limit: 3, postedLimit: "year" });
4241
+ * const res = await client.maps.reviews({ placeId: "ChIJN1t_tDeuEmsRUsoyG83frY4", limit: 3 });
4229
4242
  */
4230
4243
  reviews(input, options) {
4231
4244
  return this._core.run("maps.reviews", input, options);
@@ -4502,7 +4515,7 @@ var PerplexityNamespace = class {
4502
4515
  *
4503
4516
  * Ask Perplexity a web-grounded question and receive an answer with source citations.
4504
4517
  *
4505
- * Price: $0.00006 per request plus $0.011 per result (maximum $0.0111).
4518
+ * Price: $0.0036 per request.
4506
4519
  *
4507
4520
  * @example
4508
4521
  * const res = await client.perplexity.search({ prompt: "What is AnyAPI at getanyapi.com, and what does it offer?" });
@@ -4744,7 +4757,7 @@ var RedditNamespace = class {
4744
4757
  *
4745
4758
  * Fetch a single Reddit post by URL, including its full body text, score, comment count, upvote ratio, and subreddit, as normalized JSON.
4746
4759
  *
4747
- * Price: $0.0009 per request.
4760
+ * Price: $0.0012 per request.
4748
4761
  *
4749
4762
  * @example
4750
4763
  * const res = await client.reddit.post({ url: "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/" });
@@ -4812,7 +4825,7 @@ var RedditNamespace = class {
4812
4825
  *
4813
4826
  * Search Reddit posts across all subreddits by query.
4814
4827
  *
4815
- * Price: $0.0009 per request.
4828
+ * Price: $0.0012 per request.
4816
4829
  *
4817
4830
  * @example
4818
4831
  * const res = await client.reddit.search({ query: "mechanical keyboard" });
@@ -6429,7 +6442,7 @@ var TripadvisorNamespace = class {
6429
6442
  *
6430
6443
  * Fetch the latest reviews for any Tripadvisor hotel, restaurant, or attraction by its page URL: rating, text, date, and trip details as normalized JSON.
6431
6444
  *
6432
- * Price: $0.0036 per request.
6445
+ * Price: $0.003 per request.
6433
6446
  *
6434
6447
  * @example
6435
6448
  * 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 });
@@ -6442,7 +6455,7 @@ var TripadvisorNamespace = class {
6442
6455
  *
6443
6456
  * Search Tripadvisor for hotels, restaurants, and attractions in any destination and get rich place records (ratings, review counts, contact details, pricing) as normalized JSON.
6444
6457
  *
6445
- * Price: $0.0036 per request.
6458
+ * Price: $0.003 per request.
6446
6459
  *
6447
6460
  * @example
6448
6461
  * const res = await client.tripadvisor.search({ query: "Paris", limit: 3 });
@@ -7100,7 +7113,7 @@ var YelpNamespace = class {
7100
7113
  *
7101
7114
  * Search Yelp for businesses by keyword and location: up to 20 listings with ratings, categories, and core business info per request.
7102
7115
  *
7103
- * Price: $0.044 per request plus $0.00083 per result (maximum $0.0605).
7116
+ * Price: $0.0035 per request.
7104
7117
  *
7105
7118
  * @example
7106
7119
  * const res = await client.yelp.search({ location: "Chicago, IL", query: "pizza", limit: 5 });
@@ -7384,6 +7397,35 @@ var YoutubeNamespace = class {
7384
7397
  options
7385
7398
  );
7386
7399
  }
7400
+ /**
7401
+ * YouTube Shorts Search
7402
+ *
7403
+ * Search YouTube Shorts by keyword and get matching Shorts (title, views, URL) with cursor pagination as normalized JSON.
7404
+ *
7405
+ * Price: $0.002 per request.
7406
+ *
7407
+ * @example
7408
+ * const res = await client.youtube.searchShorts({ query: "cats" });
7409
+ */
7410
+ searchShorts(input, options) {
7411
+ return this._core.run("youtube.search_shorts", input, options);
7412
+ }
7413
+ /**
7414
+ * Iterate every result of YouTube Shorts Search across pages.
7415
+ *
7416
+ * Yields items directly; call `.pages()` on the return value to walk whole
7417
+ * result pages instead (each carries its own costUsd).
7418
+ */
7419
+ iterSearchShorts(input, options) {
7420
+ return paginate(
7421
+ this._core,
7422
+ "youtube.search_shorts",
7423
+ input,
7424
+ "shorts",
7425
+ false,
7426
+ options
7427
+ );
7428
+ }
7387
7429
  /**
7388
7430
  * YouTube Trending Shorts
7389
7431
  *
@@ -7400,7 +7442,7 @@ var YoutubeNamespace = class {
7400
7442
  /**
7401
7443
  * YouTube Video
7402
7444
  *
7403
- * Fetch a YouTube video's metadata (title, channel, views, likes, duration, publish date) by URL or ID.
7445
+ * Fetch a YouTube video or Short's metadata (title, channel, views, likes, duration, publish date) by URL or ID.
7404
7446
  *
7405
7447
  * Price: $0.00125 per request.
7406
7448
  *
@@ -7413,7 +7455,7 @@ var YoutubeNamespace = class {
7413
7455
  /**
7414
7456
  * YouTube Video Comments
7415
7457
  *
7416
- * List the comments on a YouTube video by URL with cursor pagination (text, author, likes, reply count).
7458
+ * List the comments on a YouTube video or Short by URL with cursor pagination (text, author, likes, reply count).
7417
7459
  *
7418
7460
  * Price: $0.002 per request.
7419
7461
  *
@@ -7455,7 +7497,7 @@ var YoutubeNamespace = class {
7455
7497
  /**
7456
7498
  * YouTube Video Transcript
7457
7499
  *
7458
- * Fetch the transcript/captions of a YouTube video by URL or ID.
7500
+ * Fetch the transcript/captions of a YouTube video or Short by URL or ID.
7459
7501
  *
7460
7502
  * Price: $0.00125 per request.
7461
7503
  *
@@ -7468,9 +7510,9 @@ var YoutubeNamespace = class {
7468
7510
  /**
7469
7511
  * YouTube Video Transcript (Provenance)
7470
7512
  *
7471
- * Fetch a YouTube transcript with timed segments and its provenance: whether the words are creator-written captions or machine speech recognition.
7513
+ * Fetch a YouTube video or Short transcript with timed segments and its provenance: whether the words are creator-written captions or machine speech recognition.
7472
7514
  *
7473
- * Price: $0.00308 per request plus $0 per result (maximum $0.00308).
7515
+ * Price: $0.001 per request.
7474
7516
  *
7475
7517
  * @example
7476
7518
  * const res = await client.youtube.videoTranscriptFull({ url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" });