scrapingrabbit 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ // Generated by scripts/generate.mjs from https://scrapingrabbit.com/openapi.json. Do not edit by hand.
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.METHOD_NAMES = exports.Methods = void 0;
6
+ /** One method per API endpoint (31). Each returns the answer's `data`. */
7
+ class Methods {
8
+ /** Your current balance. Free: it does not cost a credit, but it counts toward the rate limit. */
9
+ accountCredits(options) {
10
+ return this.request("/account/credits", {}, options);
11
+ }
12
+ /** See the top-selling products in any Amazon category. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Amazon.com only, and the list changes through the day. A wrong category id returns no results. */
13
+ amazonBestSellersViewer(params, options) {
14
+ return this.request("/amazon/bestsellers", params, options);
15
+ }
16
+ /** See the searches Amazon suggests as shoppers type. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Suggestions show what is popular, not how many searches happen. Results can differ by country and change over time. */
17
+ amazonKeywordTool(params, options) {
18
+ return this.request("/amazon/autocomplete", params, options);
19
+ }
20
+ /** Search Amazon and compare products by rating and price. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). One page of results per search, from Amazon.com. Prices and stock change often, and some listings show no price. */
21
+ amazonProductSearch(params, options) {
22
+ return this.request("/amazon/search", params, options);
23
+ }
24
+ /** Read what users say about any app on the App Store. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Shows one page of the most helpful reviews from the US store. Reviews are as the store shows them. We do not edit them. */
25
+ appStoreReviewsViewer(params, options) {
26
+ return this.request("/apple/reviews", params, options);
27
+ }
28
+ /** Search the App Store and compare apps by rating and price. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Results are from the US App Store. The order is the store's own and changes over time. */
29
+ appStoreSearch(params, options) {
30
+ return this.request("/apple/search", params, options);
31
+ }
32
+ /** See when a domain was registered and how old it is. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). The date is when the domain was first registered, not when the website launched. Some registries do not publish creation dates, so a few domains return no result. */
33
+ domainAgeChecker(params, options) {
34
+ return this.request("/seo/domain-age", params, options);
35
+ }
36
+ /** See a website's Moz Domain Authority, Page Authority and spam score. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Domain Authority is a Moz score. It is a rough guide to link strength, not a Google ranking factor. Scores move as Moz updates its index, so compare sites on the same day. A new site with few links usually scores low even if its content is good. */
37
+ domainAuthorityChecker(params, options) {
38
+ return this.request("/seo/domain-authority", params, options);
39
+ }
40
+ /** Check the format, mail servers and type of any email address. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). This checks the format and the domain's mail setup. It does not connect to the mailbox, so it cannot prove a specific inbox exists. Catch-all domains accept every address, so a valid result there is not a guarantee. */
41
+ emailVerifier(params, options) {
42
+ return this.request("/email/verify", params, options);
43
+ }
44
+ /** See the searches Google suggests as people type. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Suggestions are not search volumes. They show what is popular, not how many searches happen. Results can differ by country, language and time. */
45
+ googleAutocomplete(params, options) {
46
+ return this.request("/google/autocomplete", params, options);
47
+ }
48
+ /** Find local businesses with their ratings, phone numbers and websites. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Each search returns one page of results, around 20 businesses. Phone numbers and websites appear only where the business published them. */
49
+ googleMapsBusinessSearch(params, options) {
50
+ return this.request("/google/maps", params, options);
51
+ }
52
+ /** Get the latest headlines on any topic from Google News. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Headlines come from Google News and link to the publisher's own page. Results change often, so the list can differ from one hour to the next. */
53
+ googleNewsSearch(params, options) {
54
+ return this.request("/google/news", params, options);
55
+ }
56
+ /** See how interest in a search term moved over the past year. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Values are relative on a 0 to 100 scale, where 100 is the term's own peak. They are not search counts. Very rare terms may have too little data to chart. */
57
+ googleTrendsExplorer(params, options) {
58
+ return this.request("/google/trends", params, options);
59
+ }
60
+ /** Browse a profile's Instagram highlights and the stories inside them. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Photo and video links come from Instagram's own servers and may stop working after a while, so open them while you need them. A private account may show no highlights. */
61
+ instagramHighlightViewer(params, options) {
62
+ return this.request("/instagram/highlights", params, options);
63
+ }
64
+ /** View the public stats, bio and links of an Instagram profile. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Only public information is returned. Private accounts show their public header only. Counts are a snapshot and can differ slightly from the app. */
65
+ instagramProfileViewer(params, options) {
66
+ return this.request("/instagram/profile", params, options);
67
+ }
68
+ /** See if an Instagram username is free, or who has it. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Results come from public Instagram data at the time of the search. A name shown as available can still be blocked by Instagram at sign-up. */
69
+ instagramUsernameChecker(params, options) {
70
+ return this.request("/instagram/username/check", params, options);
71
+ }
72
+ /** See a public Snapchat profile without an account. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Only public profiles can be read. Private accounts show no data. Subscriber counts shown are the ones Snapchat publishes on the profile. */
73
+ snapchatProfileViewer(params, options) {
74
+ return this.request("/snapchat/profile", params, options);
75
+ }
76
+ /** See an account's engagement rate from its recent videos. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). The rate uses only the latest 10 videos, so a recent viral or flop video moves it a lot. Very large accounts often have a low rate by followers but a high rate by views, so read both numbers. Only public data is used. */
77
+ tiktokEngagementRateCalculator(params, options) {
78
+ return this.request("/tiktok/engagement", params, options);
79
+ }
80
+ /** View the public stats, bio and link of a TikTok profile. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Only public information is returned. Counts are a snapshot and can differ slightly from the app. */
81
+ tiktokProfileViewer(params, options) {
82
+ return this.request("/tiktok/profile", params, options);
83
+ }
84
+ /** Get the spoken words of any TikTok video as text. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). A transcript exists only when TikTok has captions for the video. Videos with no speech or no captions return nothing. Auto-generated captions can contain mistakes. Photo posts and private videos have no transcript. */
85
+ tiktokTranscript(params, options) {
86
+ return this.request("/tiktok/transcript", params, options);
87
+ }
88
+ /** See if a TikTok username is free, or who has it. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Results come from public TikTok data at the time of the search. A name shown as available can still be blocked by TikTok at sign-up. */
89
+ tiktokUsernameChecker(params, options) {
90
+ return this.request("/tiktok/username/check", params, options);
91
+ }
92
+ /** See the searches Walmart suggests as shoppers type. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Suggestions show what is popular, not how many searches happen. Results can differ over time. */
93
+ walmartKeywordTool(params, options) {
94
+ return this.request("/walmart/autocomplete", params, options);
95
+ }
96
+ /** Search Walmart and compare products by price and rating. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). One page of results per search. Prices and stock change often, and some listings show a price range or no price. Walmart sometimes blocks a lookup. If you see an error, try again. */
97
+ walmartProductSearch(params, options) {
98
+ return this.request("/walmart/search", params, options);
99
+ }
100
+ /** Estimate a site's organic search traffic and ranking keywords. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). These are estimates built from the keywords a site ranks for. They are not the site's own analytics. Brand-new sites and very small sites often show no data. */
101
+ websiteTrafficChecker(params, options) {
102
+ return this.request("/seo/website-traffic", params, options);
103
+ }
104
+ /** Get the spoken words of any X video as text. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). A transcript exists only when X has captions for the video. Many videos have none. Auto-generated captions can contain mistakes. Posts without a video, and private accounts, have no transcript. */
105
+ xVideoTranscript(params, options) {
106
+ return this.request("/twitter/transcript", params, options);
107
+ }
108
+ /** Get a channel's full-size banner and profile picture. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Channels without a banner show only the profile picture. Images belong to the channel owner. Use them only as the owner allows. */
109
+ youtubeBannerDownloader(params, options) {
110
+ return this.request("/youtube/channel/banner", params, options);
111
+ }
112
+ /** Turn a YouTube @handle into the channel ID. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Needs a channel handle (starting with @) or a link that contains one. Channels that have no handle cannot be looked up this way. */
113
+ youtubeChannelIdFinder(params, options) {
114
+ return this.request("/youtube/resolve", params, options);
115
+ }
116
+ /** See a channel's subscribers, views, video count and links. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Only public information is returned. Hidden subscriber counts show as unavailable. YouTube rounds large counts, so figures are close but not exact. */
117
+ youtubeChannelViewer(params, options) {
118
+ return this.request("/youtube/channel", params, options);
119
+ }
120
+ /** Read the top comments of any YouTube video with likes and replies. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). This page shows the first page of top comments, not every comment on the video. Videos with comments turned off return nothing. */
121
+ youtubeCommentExtractor(params, options) {
122
+ return this.request("/youtube/comments", params, options);
123
+ }
124
+ /** See the tags and keywords any YouTube video uses. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Tags are only shown when the creator added them. Many videos have none. Tags are a small signal for YouTube search. Title, description and viewer behavior matter far more. */
125
+ youtubeTagExtractor(params, options) {
126
+ return this.request("/youtube/video", params, options);
127
+ }
128
+ /** Convert any YouTube video to a transcript with timestamps. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). A transcript exists only when the video has captions, written by the creator or generated by YouTube. Private videos and videos with captions turned off return no transcript. Auto-generated captions can contain mistakes, especially with names and technical terms. */
129
+ youtubeTranscript(params, options) {
130
+ return this.request("/youtube/transcript", params, options);
131
+ }
132
+ }
133
+ exports.Methods = Methods;
134
+ /** Every endpoint's method name, for tests and tooling. */
135
+ exports.METHOD_NAMES = ["accountCredits", "amazonBestSellersViewer", "amazonKeywordTool", "amazonProductSearch", "appStoreReviewsViewer", "appStoreSearch", "domainAgeChecker", "domainAuthorityChecker", "emailVerifier", "googleAutocomplete", "googleMapsBusinessSearch", "googleNewsSearch", "googleTrendsExplorer", "instagramHighlightViewer", "instagramProfileViewer", "instagramUsernameChecker", "snapchatProfileViewer", "tiktokEngagementRateCalculator", "tiktokProfileViewer", "tiktokTranscript", "tiktokUsernameChecker", "walmartKeywordTool", "walmartProductSearch", "websiteTrafficChecker", "xVideoTranscript", "youtubeBannerDownloader", "youtubeChannelIdFinder", "youtubeChannelViewer", "youtubeCommentExtractor", "youtubeTagExtractor", "youtubeTranscript"];
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,29 @@
1
+ import { Methods, type RequestOptions } from "./methods.generated.js";
2
+ export declare const DEFAULT_BASE_URL = "https://api.scrapingrabbit.com/v1";
3
+ export interface ClientOptions {
4
+ /** Defaults to the SCRAPINGRABBIT_API_KEY environment variable. */
5
+ apiKey?: string;
6
+ baseUrl?: string;
7
+ /** Per-call timeout in milliseconds. Default 90000. */
8
+ timeoutMs?: number;
9
+ /** Retries for rate limits (429), server errors (5xx) and network errors. Default 2. */
10
+ maxRetries?: number;
11
+ /** Custom fetch (tests, proxies). Defaults to the global fetch (Node 18+). */
12
+ fetch?: typeof fetch;
13
+ }
14
+ /** The API refused or failed a call. Failed calls are not charged. */
15
+ export declare class ScrapingRabbitError extends Error {
16
+ readonly code: string;
17
+ readonly status: number | undefined;
18
+ readonly retryAfter: number | undefined;
19
+ constructor(message: string, code?: string, status?: number, retryAfter?: number);
20
+ }
21
+ /**
22
+ * ScrapingRabbit API client. `new ScrapingRabbit().youtubeTranscript({ url })` resolves to the answer's `data`.
23
+ * Keep the key on the server: anyone who can read it can spend your credits.
24
+ */
25
+ export declare class ScrapingRabbit extends Methods {
26
+ #private;
27
+ constructor(options?: ClientOptions);
28
+ protected request<T>(path: string, query: object, options?: RequestOptions): Promise<T>;
29
+ }
@@ -0,0 +1,170 @@
1
+ import { Methods } from "./methods.generated.js";
2
+ export const DEFAULT_BASE_URL = "https://api.scrapingrabbit.com/v1";
3
+ // Longer than the API's slowest route class (70 s at the gateway), so the API's own answer arrives first.
4
+ const DEFAULT_TIMEOUT_MS = 90_000;
5
+ const MAX_WAIT_MS = 30_000;
6
+ /** The API refused or failed a call. Failed calls are not charged. */
7
+ export class ScrapingRabbitError extends Error {
8
+ code;
9
+ status;
10
+ retryAfter;
11
+ constructor(message, code = "UNKNOWN", status, retryAfter) {
12
+ super(`${code}: ${message}`);
13
+ this.name = "ScrapingRabbitError";
14
+ this.code = code;
15
+ this.status = status;
16
+ this.retryAfter = retryAfter;
17
+ }
18
+ }
19
+ const backoff = (attempt) => Math.min(1000 * 2 ** attempt, MAX_WAIT_MS);
20
+ /** Waits `ms`, or rejects with the signal's reason the moment it aborts. */
21
+ function sleep(ms, signal) {
22
+ return new Promise((resolve, reject) => {
23
+ if (signal?.aborted)
24
+ return reject(signal.reason);
25
+ const onAbort = () => {
26
+ clearTimeout(timer);
27
+ reject(signal?.reason);
28
+ };
29
+ const timer = setTimeout(() => {
30
+ signal?.removeEventListener("abort", onAbort);
31
+ resolve();
32
+ }, ms);
33
+ signal?.addEventListener("abort", onAbort, { once: true });
34
+ });
35
+ }
36
+ /** Milliseconds to wait before retrying, or undefined to give up. Refusals (4xx other than 429) are final. */
37
+ function retryDelay(error, attempt) {
38
+ if (error.code === "NETWORK_ERROR")
39
+ return backoff(attempt);
40
+ if (error.status === 429) {
41
+ if (error.retryAfter === undefined)
42
+ return backoff(attempt);
43
+ // Retrying sooner than the server asked only earns another 429; past our cap, the caller decides.
44
+ return error.retryAfter * 1000 <= MAX_WAIT_MS ? error.retryAfter * 1000 : undefined;
45
+ }
46
+ // A 504 means a slow route already used its full time at the gateway, so repeating it rarely helps.
47
+ if (error.status !== undefined && error.status >= 500 && error.status !== 504)
48
+ return backoff(attempt);
49
+ return undefined;
50
+ }
51
+ /**
52
+ * Aborts when either signal does (AbortSignal.any needs Node 20.3; this package supports Node 18).
53
+ * Call `cleanup` when done, or a signal reused across calls collects one listener per call.
54
+ */
55
+ function eitherSignal(a, b) {
56
+ const controller = new AbortController();
57
+ const added = [];
58
+ for (const source of [a, b]) {
59
+ if (source.aborted) {
60
+ controller.abort(source.reason);
61
+ break;
62
+ }
63
+ const onAbort = () => controller.abort(source.reason);
64
+ source.addEventListener("abort", onAbort, { once: true });
65
+ added.push([source, onAbort]);
66
+ }
67
+ return {
68
+ signal: controller.signal,
69
+ cleanup: () => {
70
+ for (const [source, onAbort] of added)
71
+ source.removeEventListener("abort", onAbort);
72
+ },
73
+ };
74
+ }
75
+ function readEnvKey() {
76
+ const env = globalThis.process?.env;
77
+ return env?.SCRAPINGRABBIT_API_KEY;
78
+ }
79
+ /** The envelope's `data` for a success, otherwise a ScrapingRabbitError. `text` is the fully read body. */
80
+ function unwrap(response, text) {
81
+ let body;
82
+ try {
83
+ body = JSON.parse(text);
84
+ }
85
+ catch {
86
+ body = undefined; // not JSON (for example a proxy's HTML error page)
87
+ }
88
+ const envelope = body !== null && typeof body === "object" ? body : undefined;
89
+ if (response.ok && envelope && envelope.success !== false) {
90
+ return ("data" in envelope ? envelope.data : envelope);
91
+ }
92
+ const header = response.headers.get("retry-after");
93
+ const retryAfter = header !== null && /^\d+(\.\d+)?$/.test(header) ? Number(header) : undefined;
94
+ const message = envelope?.message !== undefined ? String(envelope.message) : `HTTP ${response.status}`;
95
+ const code = envelope?.code !== undefined ? String(envelope.code) : "UNKNOWN";
96
+ throw new ScrapingRabbitError(message, code, response.status, retryAfter);
97
+ }
98
+ /**
99
+ * ScrapingRabbit API client. `new ScrapingRabbit().youtubeTranscript({ url })` resolves to the answer's `data`.
100
+ * Keep the key on the server: anyone who can read it can spend your credits.
101
+ */
102
+ export class ScrapingRabbit extends Methods {
103
+ #apiKey;
104
+ #baseUrl;
105
+ #timeoutMs;
106
+ #maxRetries;
107
+ #fetch;
108
+ constructor(options = {}) {
109
+ super();
110
+ const apiKey = options.apiKey ?? readEnvKey();
111
+ if (!apiKey) {
112
+ throw new ScrapingRabbitError("No API key. Pass { apiKey } or set SCRAPINGRABBIT_API_KEY. Get a free key (100 credits, no card) at https://scrapingrabbit.com/login", "MISSING_API_KEY");
113
+ }
114
+ const fetchImpl = options.fetch ?? globalThis.fetch;
115
+ if (typeof fetchImpl !== "function")
116
+ throw new ScrapingRabbitError("No fetch available. Use Node 18+ or pass { fetch }.", "NO_FETCH");
117
+ this.#apiKey = apiKey;
118
+ this.#baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
119
+ this.#timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
120
+ this.#maxRetries = Math.max(0, options.maxRetries ?? 2);
121
+ this.#fetch = fetchImpl;
122
+ }
123
+ async request(path, query, options = {}) {
124
+ const url = new URL(this.#baseUrl + path);
125
+ for (const [name, value] of Object.entries(query)) {
126
+ if (value !== undefined && value !== null && value !== "")
127
+ url.searchParams.set(name, String(value));
128
+ }
129
+ // Retrying is safe: a call is charged only when it succeeds.
130
+ for (let attempt = 0;; attempt++) {
131
+ try {
132
+ return await this.#once(url, options);
133
+ }
134
+ catch (error) {
135
+ if (!(error instanceof ScrapingRabbitError))
136
+ throw error;
137
+ const wait = retryDelay(error, attempt);
138
+ if (wait === undefined || attempt >= this.#maxRetries)
139
+ throw error;
140
+ await sleep(wait, options.signal);
141
+ }
142
+ }
143
+ }
144
+ async #once(url, options) {
145
+ const timeoutMs = options.timeoutMs ?? this.#timeoutMs;
146
+ const timeout = AbortSignal.timeout(timeoutMs);
147
+ const combined = options.signal ? eitherSignal(options.signal, timeout) : { signal: timeout, cleanup: () => { } };
148
+ try {
149
+ let response;
150
+ let text;
151
+ try {
152
+ // The key only travels in this header, never in the URL.
153
+ response = await this.#fetch(url, { headers: { "x-api-key": this.#apiKey, accept: "application/json" }, signal: combined.signal });
154
+ // Read the body under the same signal, so a cancel or timeout mid-download is reported as such.
155
+ text = await response.text();
156
+ }
157
+ catch (error) {
158
+ if (options.signal?.aborted)
159
+ throw options.signal.reason ?? error;
160
+ if (timeout.aborted)
161
+ throw new ScrapingRabbitError(`No answer within ${timeoutMs} ms`, "TIMEOUT");
162
+ throw new ScrapingRabbitError(`Could not reach the API: ${error instanceof Error ? error.message : String(error)}`, "NETWORK_ERROR");
163
+ }
164
+ return unwrap(response, text);
165
+ }
166
+ finally {
167
+ combined.cleanup();
168
+ }
169
+ }
170
+ }
@@ -0,0 +1,2 @@
1
+ export { ScrapingRabbit, ScrapingRabbitError, DEFAULT_BASE_URL, type ClientOptions } from "./client.js";
2
+ export * from "./methods.generated.js";
@@ -0,0 +1,2 @@
1
+ export { ScrapingRabbit, ScrapingRabbitError, DEFAULT_BASE_URL } from "./client.js";
2
+ export * from "./methods.generated.js";
@@ -0,0 +1,196 @@
1
+ export interface RequestOptions {
2
+ /** Cancel the call. */
3
+ signal?: AbortSignal;
4
+ /** Override the client's timeout for this call, in milliseconds. */
5
+ timeoutMs?: number;
6
+ }
7
+ export interface AmazonBestSellersViewerParams {
8
+ /** Category id. Use a category id such as electronics, books or home-garden. A sub-category looks like electronics/281407. */
9
+ category_id: string;
10
+ }
11
+ export interface AmazonKeywordToolParams {
12
+ /** Start of a search. Type a word or phrase a shopper might start with. */
13
+ query: string;
14
+ }
15
+ export interface AmazonProductSearchParams {
16
+ /** Product search. Type what you would search for on Amazon. */
17
+ query: string;
18
+ }
19
+ export interface AppStoreReviewsViewerParams {
20
+ /** App Store link or app id. Paste an App Store link, or the number after 'id' in it. */
21
+ product_id: string;
22
+ }
23
+ export interface AppStoreSearchParams {
24
+ /** App name or topic. Type an app name or what the app does. */
25
+ query: string;
26
+ }
27
+ export interface DomainAgeCheckerParams {
28
+ /** Domain name. Enter a domain such as example.com. Links are cleaned up for you. */
29
+ domain: string;
30
+ }
31
+ export interface DomainAuthorityCheckerParams {
32
+ /** Domain name. Enter a domain such as example.com. Links are cleaned up for you. */
33
+ domain: string;
34
+ }
35
+ export interface EmailVerifierParams {
36
+ /** Email address. Enter one email address. */
37
+ email: string;
38
+ }
39
+ export interface GoogleAutocompleteParams {
40
+ /** Start of a search. Type a word or phrase. Add a trailing space to see what usually comes next. */
41
+ query: string;
42
+ }
43
+ export interface GoogleMapsBusinessSearchParams {
44
+ /** What and where. Type a business type and a place, like a search on Google Maps. */
45
+ query: string;
46
+ }
47
+ export interface GoogleNewsSearchParams {
48
+ /** Topic or company. Type a topic, a company or a person. */
49
+ query: string;
50
+ }
51
+ export interface GoogleTrendsExplorerParams {
52
+ /** Search term. Type one search term. */
53
+ query: string;
54
+ }
55
+ export interface InstagramHighlightViewerParams {
56
+ /** Instagram username. Type a username with or without the @, or paste a profile link. */
57
+ username: string;
58
+ }
59
+ export interface InstagramProfileViewerParams {
60
+ /** Instagram username. Type a username with or without the @, or paste a profile link. */
61
+ username: string;
62
+ }
63
+ export interface InstagramUsernameCheckerParams {
64
+ /** Instagram username. Type a username with or without the @, or paste a profile link. */
65
+ username: string;
66
+ }
67
+ export interface SnapchatProfileViewerParams {
68
+ /** Snapchat username. Enter a username, with or without the @. */
69
+ username: string;
70
+ }
71
+ export interface TiktokEngagementRateCalculatorParams {
72
+ /** TikTok username. Type a username with or without the @, or paste a profile link. */
73
+ username: string;
74
+ }
75
+ export interface TiktokProfileViewerParams {
76
+ /** TikTok username. Type a username with or without the @, or paste a profile link. */
77
+ username: string;
78
+ }
79
+ export interface TiktokTranscriptParams {
80
+ /** TikTok video link. Paste the full video link. Short vm.tiktok.com links are not supported, open them first and copy the long link. */
81
+ url: string;
82
+ }
83
+ export interface TiktokUsernameCheckerParams {
84
+ /** TikTok username. Type a username with or without the @, or paste a profile link. */
85
+ username: string;
86
+ }
87
+ export interface WalmartKeywordToolParams {
88
+ /** Start of a search. Type a word or phrase a shopper might start with. */
89
+ query: string;
90
+ }
91
+ export interface WalmartProductSearchParams {
92
+ /** Product search. Type what you would search for on Walmart. */
93
+ query: string;
94
+ }
95
+ export interface WebsiteTrafficCheckerParams {
96
+ /** Domain name. Enter a domain such as example.com. Links are cleaned up for you. */
97
+ domain: string;
98
+ }
99
+ export interface XVideoTranscriptParams {
100
+ /** X post link. Paste the link of a post that has a video. x.com and twitter.com links both work. */
101
+ url: string;
102
+ }
103
+ export interface YoutubeBannerDownloaderParams {
104
+ /** Channel handle or link. Enter a handle like @mkbhd, a youtube.com link or a channel ID. */
105
+ channel_id: string;
106
+ }
107
+ export interface YoutubeChannelIdFinderParams {
108
+ /** Channel handle or link. Enter a handle like @mkbhd, or a youtube.com/@handle link. */
109
+ handle: string;
110
+ }
111
+ export interface YoutubeChannelViewerParams {
112
+ /** Channel handle or link. Use a @handle, a channel link, or a channel ID that starts with UC. */
113
+ channel_id: string;
114
+ }
115
+ export interface YoutubeCommentExtractorParams {
116
+ /** YouTube video link. Works with watch, youtu.be, Shorts and embed links, or a bare video ID. */
117
+ url: string;
118
+ /** Get the next page of comments. Pass the pagination.next_page_token from the previous answer, unchanged. Each page is one call. */
119
+ next_page_token?: string;
120
+ }
121
+ export interface YoutubeTagExtractorParams {
122
+ /** YouTube video link. Works with watch, youtu.be, Shorts and embed links, or a bare video ID. */
123
+ url: string;
124
+ }
125
+ export interface YoutubeTranscriptParams {
126
+ /** YouTube video link. Works with watch, youtu.be, Shorts and embed links, or a bare video ID. */
127
+ url: string;
128
+ }
129
+ /** One method per API endpoint (31). Each returns the answer's `data`. */
130
+ export declare abstract class Methods {
131
+ protected abstract request<T>(path: string, query: object, options?: RequestOptions): Promise<T>;
132
+ /** Your current balance. Free: it does not cost a credit, but it counts toward the rate limit. */
133
+ accountCredits<T = any>(options?: RequestOptions): Promise<T>;
134
+ /** See the top-selling products in any Amazon category. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Amazon.com only, and the list changes through the day. A wrong category id returns no results. */
135
+ amazonBestSellersViewer<T = any>(params: AmazonBestSellersViewerParams, options?: RequestOptions): Promise<T>;
136
+ /** See the searches Amazon suggests as shoppers type. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Suggestions show what is popular, not how many searches happen. Results can differ by country and change over time. */
137
+ amazonKeywordTool<T = any>(params: AmazonKeywordToolParams, options?: RequestOptions): Promise<T>;
138
+ /** Search Amazon and compare products by rating and price. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). One page of results per search, from Amazon.com. Prices and stock change often, and some listings show no price. */
139
+ amazonProductSearch<T = any>(params: AmazonProductSearchParams, options?: RequestOptions): Promise<T>;
140
+ /** Read what users say about any app on the App Store. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Shows one page of the most helpful reviews from the US store. Reviews are as the store shows them. We do not edit them. */
141
+ appStoreReviewsViewer<T = any>(params: AppStoreReviewsViewerParams, options?: RequestOptions): Promise<T>;
142
+ /** Search the App Store and compare apps by rating and price. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Results are from the US App Store. The order is the store's own and changes over time. */
143
+ appStoreSearch<T = any>(params: AppStoreSearchParams, options?: RequestOptions): Promise<T>;
144
+ /** See when a domain was registered and how old it is. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). The date is when the domain was first registered, not when the website launched. Some registries do not publish creation dates, so a few domains return no result. */
145
+ domainAgeChecker<T = any>(params: DomainAgeCheckerParams, options?: RequestOptions): Promise<T>;
146
+ /** See a website's Moz Domain Authority, Page Authority and spam score. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Domain Authority is a Moz score. It is a rough guide to link strength, not a Google ranking factor. Scores move as Moz updates its index, so compare sites on the same day. A new site with few links usually scores low even if its content is good. */
147
+ domainAuthorityChecker<T = any>(params: DomainAuthorityCheckerParams, options?: RequestOptions): Promise<T>;
148
+ /** Check the format, mail servers and type of any email address. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). This checks the format and the domain's mail setup. It does not connect to the mailbox, so it cannot prove a specific inbox exists. Catch-all domains accept every address, so a valid result there is not a guarantee. */
149
+ emailVerifier<T = any>(params: EmailVerifierParams, options?: RequestOptions): Promise<T>;
150
+ /** See the searches Google suggests as people type. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Suggestions are not search volumes. They show what is popular, not how many searches happen. Results can differ by country, language and time. */
151
+ googleAutocomplete<T = any>(params: GoogleAutocompleteParams, options?: RequestOptions): Promise<T>;
152
+ /** Find local businesses with their ratings, phone numbers and websites. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Each search returns one page of results, around 20 businesses. Phone numbers and websites appear only where the business published them. */
153
+ googleMapsBusinessSearch<T = any>(params: GoogleMapsBusinessSearchParams, options?: RequestOptions): Promise<T>;
154
+ /** Get the latest headlines on any topic from Google News. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Headlines come from Google News and link to the publisher's own page. Results change often, so the list can differ from one hour to the next. */
155
+ googleNewsSearch<T = any>(params: GoogleNewsSearchParams, options?: RequestOptions): Promise<T>;
156
+ /** See how interest in a search term moved over the past year. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Values are relative on a 0 to 100 scale, where 100 is the term's own peak. They are not search counts. Very rare terms may have too little data to chart. */
157
+ googleTrendsExplorer<T = any>(params: GoogleTrendsExplorerParams, options?: RequestOptions): Promise<T>;
158
+ /** Browse a profile's Instagram highlights and the stories inside them. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Photo and video links come from Instagram's own servers and may stop working after a while, so open them while you need them. A private account may show no highlights. */
159
+ instagramHighlightViewer<T = any>(params: InstagramHighlightViewerParams, options?: RequestOptions): Promise<T>;
160
+ /** View the public stats, bio and links of an Instagram profile. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Only public information is returned. Private accounts show their public header only. Counts are a snapshot and can differ slightly from the app. */
161
+ instagramProfileViewer<T = any>(params: InstagramProfileViewerParams, options?: RequestOptions): Promise<T>;
162
+ /** See if an Instagram username is free, or who has it. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Results come from public Instagram data at the time of the search. A name shown as available can still be blocked by Instagram at sign-up. */
163
+ instagramUsernameChecker<T = any>(params: InstagramUsernameCheckerParams, options?: RequestOptions): Promise<T>;
164
+ /** See a public Snapchat profile without an account. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Only public profiles can be read. Private accounts show no data. Subscriber counts shown are the ones Snapchat publishes on the profile. */
165
+ snapchatProfileViewer<T = any>(params: SnapchatProfileViewerParams, options?: RequestOptions): Promise<T>;
166
+ /** See an account's engagement rate from its recent videos. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). The rate uses only the latest 10 videos, so a recent viral or flop video moves it a lot. Very large accounts often have a low rate by followers but a high rate by views, so read both numbers. Only public data is used. */
167
+ tiktokEngagementRateCalculator<T = any>(params: TiktokEngagementRateCalculatorParams, options?: RequestOptions): Promise<T>;
168
+ /** View the public stats, bio and link of a TikTok profile. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Only public information is returned. Counts are a snapshot and can differ slightly from the app. */
169
+ tiktokProfileViewer<T = any>(params: TiktokProfileViewerParams, options?: RequestOptions): Promise<T>;
170
+ /** Get the spoken words of any TikTok video as text. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). A transcript exists only when TikTok has captions for the video. Videos with no speech or no captions return nothing. Auto-generated captions can contain mistakes. Photo posts and private videos have no transcript. */
171
+ tiktokTranscript<T = any>(params: TiktokTranscriptParams, options?: RequestOptions): Promise<T>;
172
+ /** See if a TikTok username is free, or who has it. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Results come from public TikTok data at the time of the search. A name shown as available can still be blocked by TikTok at sign-up. */
173
+ tiktokUsernameChecker<T = any>(params: TiktokUsernameCheckerParams, options?: RequestOptions): Promise<T>;
174
+ /** See the searches Walmart suggests as shoppers type. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Suggestions show what is popular, not how many searches happen. Results can differ over time. */
175
+ walmartKeywordTool<T = any>(params: WalmartKeywordToolParams, options?: RequestOptions): Promise<T>;
176
+ /** Search Walmart and compare products by price and rating. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). One page of results per search. Prices and stock change often, and some listings show a price range or no price. Walmart sometimes blocks a lookup. If you see an error, try again. */
177
+ walmartProductSearch<T = any>(params: WalmartProductSearchParams, options?: RequestOptions): Promise<T>;
178
+ /** Estimate a site's organic search traffic and ranking keywords. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). These are estimates built from the keywords a site ranks for. They are not the site's own analytics. Brand-new sites and very small sites often show no data. */
179
+ websiteTrafficChecker<T = any>(params: WebsiteTrafficCheckerParams, options?: RequestOptions): Promise<T>;
180
+ /** Get the spoken words of any X video as text. Costs 5 credits per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). A transcript exists only when X has captions for the video. Many videos have none. Auto-generated captions can contain mistakes. Posts without a video, and private accounts, have no transcript. */
181
+ xVideoTranscript<T = any>(params: XVideoTranscriptParams, options?: RequestOptions): Promise<T>;
182
+ /** Get a channel's full-size banner and profile picture. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Channels without a banner show only the profile picture. Images belong to the channel owner. Use them only as the owner allows. */
183
+ youtubeBannerDownloader<T = any>(params: YoutubeBannerDownloaderParams, options?: RequestOptions): Promise<T>;
184
+ /** Turn a YouTube @handle into the channel ID. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Needs a channel handle (starting with @) or a link that contains one. Channels that have no handle cannot be looked up this way. */
185
+ youtubeChannelIdFinder<T = any>(params: YoutubeChannelIdFinderParams, options?: RequestOptions): Promise<T>;
186
+ /** See a channel's subscribers, views, video count and links. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Only public information is returned. Hidden subscriber counts show as unavailable. YouTube rounds large counts, so figures are close but not exact. */
187
+ youtubeChannelViewer<T = any>(params: YoutubeChannelViewerParams, options?: RequestOptions): Promise<T>;
188
+ /** Read the top comments of any YouTube video with likes and replies. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). This page shows the first page of top comments, not every comment on the video. Videos with comments turned off return nothing. */
189
+ youtubeCommentExtractor<T = any>(params: YoutubeCommentExtractorParams, options?: RequestOptions): Promise<T>;
190
+ /** See the tags and keywords any YouTube video uses. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). Tags are only shown when the creator added them. Many videos have none. Tags are a small signal for YouTube search. Title, description and viewer behavior matter far more. */
191
+ youtubeTagExtractor<T = any>(params: YoutubeTagExtractorParams, options?: RequestOptions): Promise<T>;
192
+ /** Convert any YouTube video to a transcript with timestamps. Costs 1 credit per successful call. Time limit: 30 seconds (504 UPSTREAM_TIMEOUT after that, not charged). A transcript exists only when the video has captions, written by the creator or generated by YouTube. Private videos and videos with captions turned off return no transcript. Auto-generated captions can contain mistakes, especially with names and technical terms. */
193
+ youtubeTranscript<T = any>(params: YoutubeTranscriptParams, options?: RequestOptions): Promise<T>;
194
+ }
195
+ /** Every endpoint's method name, for tests and tooling. */
196
+ export declare const METHOD_NAMES: readonly ["accountCredits", "amazonBestSellersViewer", "amazonKeywordTool", "amazonProductSearch", "appStoreReviewsViewer", "appStoreSearch", "domainAgeChecker", "domainAuthorityChecker", "emailVerifier", "googleAutocomplete", "googleMapsBusinessSearch", "googleNewsSearch", "googleTrendsExplorer", "instagramHighlightViewer", "instagramProfileViewer", "instagramUsernameChecker", "snapchatProfileViewer", "tiktokEngagementRateCalculator", "tiktokProfileViewer", "tiktokTranscript", "tiktokUsernameChecker", "walmartKeywordTool", "walmartProductSearch", "websiteTrafficChecker", "xVideoTranscript", "youtubeBannerDownloader", "youtubeChannelIdFinder", "youtubeChannelViewer", "youtubeCommentExtractor", "youtubeTagExtractor", "youtubeTranscript"];