scrapebadger 0.25.0 → 0.26.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.
- package/README.md +1 -0
- package/dist/index.d.cts +439 -21
- package/dist/index.d.ts +439 -21
- package/dist/index.js +151 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +148 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6826,6 +6826,150 @@ var LinkedInClient = class {
|
|
|
6826
6826
|
}
|
|
6827
6827
|
};
|
|
6828
6828
|
|
|
6829
|
+
// src/chatgpt/ask.ts
|
|
6830
|
+
var AskClient = class {
|
|
6831
|
+
client;
|
|
6832
|
+
constructor(client) {
|
|
6833
|
+
this.client = client;
|
|
6834
|
+
}
|
|
6835
|
+
/**
|
|
6836
|
+
* Ask ChatGPT a question and get the answer with its sources.
|
|
6837
|
+
*
|
|
6838
|
+
* Costs 20 credits. Typical latency is 20-25s ungrounded, 30-70s with web search.
|
|
6839
|
+
*
|
|
6840
|
+
* @param params - Ask parameters.
|
|
6841
|
+
* @param params.prompt - The prompt to send (max 4096 characters).
|
|
6842
|
+
* @param params.country - ISO-3166 alpha-2 egress country (default: "US").
|
|
6843
|
+
* @param params.web_search - "auto", "force", or "off" (default: "auto").
|
|
6844
|
+
* @returns The answer, its citations, and the full retrieved search set.
|
|
6845
|
+
*
|
|
6846
|
+
* @example
|
|
6847
|
+
* ```typescript
|
|
6848
|
+
* const result = await client.chatgpt.ask.ask({
|
|
6849
|
+
* prompt: "what is the best CRM for a 10-person startup?",
|
|
6850
|
+
* country: "GB",
|
|
6851
|
+
* web_search: "force",
|
|
6852
|
+
* });
|
|
6853
|
+
* console.log(result.web_search_triggered, result.model);
|
|
6854
|
+
* for (const source of result.search_results) {
|
|
6855
|
+
* console.log(`${source.cited ? "*" : " "} ${source.url}`);
|
|
6856
|
+
* }
|
|
6857
|
+
* ```
|
|
6858
|
+
*/
|
|
6859
|
+
async ask(params) {
|
|
6860
|
+
return this.client.request("/v1/chatgpt/ask", {
|
|
6861
|
+
params: {
|
|
6862
|
+
prompt: params.prompt,
|
|
6863
|
+
country: params.country,
|
|
6864
|
+
web_search: params.web_search
|
|
6865
|
+
}
|
|
6866
|
+
});
|
|
6867
|
+
}
|
|
6868
|
+
};
|
|
6869
|
+
|
|
6870
|
+
// src/chatgpt/brand.ts
|
|
6871
|
+
var BrandClient = class {
|
|
6872
|
+
client;
|
|
6873
|
+
constructor(client) {
|
|
6874
|
+
this.client = client;
|
|
6875
|
+
}
|
|
6876
|
+
/**
|
|
6877
|
+
* Analyse how a brand shows up in ChatGPT's answer to a prompt.
|
|
6878
|
+
*
|
|
6879
|
+
* Costs 25 credits.
|
|
6880
|
+
*
|
|
6881
|
+
* @param params - Brand-visibility parameters.
|
|
6882
|
+
* @param params.prompt - The prompt to send (max 4096 characters).
|
|
6883
|
+
* @param params.brand - The brand name to look for in the answer.
|
|
6884
|
+
* @param params.domain - The brand's domain, used to detect brand citations.
|
|
6885
|
+
* @param params.aliases - Other spellings that should count as mentions.
|
|
6886
|
+
* @param params.competitors - Competitors to measure share of voice against.
|
|
6887
|
+
* @param params.country - ISO-3166 alpha-2 egress country (default: "US").
|
|
6888
|
+
* @param params.web_search - "auto", "force", or "off" (default: "force").
|
|
6889
|
+
* @returns The brand analysis plus the answer and its citations.
|
|
6890
|
+
*
|
|
6891
|
+
* @example
|
|
6892
|
+
* ```typescript
|
|
6893
|
+
* const result = await client.chatgpt.brand.visibility({
|
|
6894
|
+
* prompt: "which proxy provider should I use?",
|
|
6895
|
+
* brand: "ScrapeBadger",
|
|
6896
|
+
* domain: "scrapebadger.com",
|
|
6897
|
+
* aliases: ["Scrape Badger"],
|
|
6898
|
+
* competitors: ["Bright Data", "Oxylabs"],
|
|
6899
|
+
* country: "DE",
|
|
6900
|
+
* });
|
|
6901
|
+
* console.log(`position score: ${result.position_score}`);
|
|
6902
|
+
* for (const competitor of result.competitors) {
|
|
6903
|
+
* console.log(`${competitor.name}: ${competitor.mention_count}`);
|
|
6904
|
+
* }
|
|
6905
|
+
* ```
|
|
6906
|
+
*/
|
|
6907
|
+
async visibility(params) {
|
|
6908
|
+
return this.client.request("/v1/chatgpt/brand-visibility", {
|
|
6909
|
+
params: {
|
|
6910
|
+
prompt: params.prompt,
|
|
6911
|
+
brand: params.brand,
|
|
6912
|
+
domain: params.domain,
|
|
6913
|
+
aliases: params.aliases?.length ? params.aliases.join(",") : void 0,
|
|
6914
|
+
competitors: params.competitors?.length ? params.competitors.join(",") : void 0,
|
|
6915
|
+
country: params.country,
|
|
6916
|
+
web_search: params.web_search
|
|
6917
|
+
}
|
|
6918
|
+
});
|
|
6919
|
+
}
|
|
6920
|
+
};
|
|
6921
|
+
|
|
6922
|
+
// src/chatgpt/reference.ts
|
|
6923
|
+
var ReferenceClient11 = class {
|
|
6924
|
+
client;
|
|
6925
|
+
constructor(client) {
|
|
6926
|
+
this.client = client;
|
|
6927
|
+
}
|
|
6928
|
+
/**
|
|
6929
|
+
* Get the models chatgpt.com currently offers.
|
|
6930
|
+
*
|
|
6931
|
+
* Costs 1 credit.
|
|
6932
|
+
*
|
|
6933
|
+
* @param params - Optional parameters.
|
|
6934
|
+
* @param params.country - ISO-3166 alpha-2 egress country (default: "US").
|
|
6935
|
+
* @returns The available models.
|
|
6936
|
+
*
|
|
6937
|
+
* @example
|
|
6938
|
+
* ```typescript
|
|
6939
|
+
* const result = await client.chatgpt.reference.models({ country: "GB" });
|
|
6940
|
+
* console.log(`${result.count} models`);
|
|
6941
|
+
* for (const model of result.models) {
|
|
6942
|
+
* console.log(`${model.slug}: ${model.max_tokens} tokens`);
|
|
6943
|
+
* }
|
|
6944
|
+
* ```
|
|
6945
|
+
*/
|
|
6946
|
+
async models(params = {}) {
|
|
6947
|
+
return this.client.request("/v1/chatgpt/models", {
|
|
6948
|
+
params: { country: params.country }
|
|
6949
|
+
});
|
|
6950
|
+
}
|
|
6951
|
+
};
|
|
6952
|
+
|
|
6953
|
+
// src/chatgpt/client.ts
|
|
6954
|
+
var ChatGPTClient = class {
|
|
6955
|
+
/** Client for asking ChatGPT a question */
|
|
6956
|
+
ask;
|
|
6957
|
+
/** Client for AEO/GEO brand-visibility analysis */
|
|
6958
|
+
brand;
|
|
6959
|
+
/** Client for reference data (available models) */
|
|
6960
|
+
reference;
|
|
6961
|
+
/**
|
|
6962
|
+
* Create a new ChatGPT client.
|
|
6963
|
+
*
|
|
6964
|
+
* @param client - The base HTTP client for making requests.
|
|
6965
|
+
*/
|
|
6966
|
+
constructor(client) {
|
|
6967
|
+
this.ask = new AskClient(client);
|
|
6968
|
+
this.brand = new BrandClient(client);
|
|
6969
|
+
this.reference = new ReferenceClient11(client);
|
|
6970
|
+
}
|
|
6971
|
+
};
|
|
6972
|
+
|
|
6829
6973
|
// src/client.ts
|
|
6830
6974
|
var ScrapeBadger = class {
|
|
6831
6975
|
baseClient;
|
|
@@ -6865,6 +7009,8 @@ var ScrapeBadger = class {
|
|
|
6865
7009
|
depop;
|
|
6866
7010
|
/** LinkedIn scraper API client — 11 no-auth endpoints (jobs, company, school, profile, post, article, learning, geo) */
|
|
6867
7011
|
linkedin;
|
|
7012
|
+
/** ChatGPT scraper API client — ask, brand visibility, models (the real chatgpt.com, anonymous) */
|
|
7013
|
+
chatgpt;
|
|
6868
7014
|
/**
|
|
6869
7015
|
* Create a new ScrapeBadger client.
|
|
6870
7016
|
*
|
|
@@ -6917,6 +7063,7 @@ var ScrapeBadger = class {
|
|
|
6917
7063
|
this.loopnet = new LoopNetClient(this.baseClient);
|
|
6918
7064
|
this.depop = new DepopClient(this.baseClient);
|
|
6919
7065
|
this.linkedin = new LinkedInClient(this.baseClient);
|
|
7066
|
+
this.chatgpt = new ChatGPTClient(this.baseClient);
|
|
6920
7067
|
}
|
|
6921
7068
|
};
|
|
6922
7069
|
|
|
@@ -6928,6 +7075,10 @@ exports.AmazonReferenceClient = ReferenceClient2;
|
|
|
6928
7075
|
exports.AmazonSearchClient = SearchClient4;
|
|
6929
7076
|
exports.AmazonSellersClient = SellersClient;
|
|
6930
7077
|
exports.AuthenticationError = AuthenticationError;
|
|
7078
|
+
exports.ChatGPTAskClient = AskClient;
|
|
7079
|
+
exports.ChatGPTBrandClient = BrandClient;
|
|
7080
|
+
exports.ChatGPTClient = ChatGPTClient;
|
|
7081
|
+
exports.ChatGPTReferenceClient = ReferenceClient11;
|
|
6931
7082
|
exports.CommunitiesClient = CommunitiesClient;
|
|
6932
7083
|
exports.ConflictError = ConflictError;
|
|
6933
7084
|
exports.DepopClient = DepopClient;
|