Skip to content

Commit 71b065a

Browse files
Merge pull request #9 from outscraper/os-add-similarweb-company-insights-finder
added similarweb, company website finder
2 parents fff5227 + 2763c30 commit 71b065a

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,28 @@ class Outscraper {
408408
});
409409
return this.handleAsyncResponse(response, asyncRequest);
410410
}
411+
412+
async similarweb(query, fields = null, asyncRequest = false, ui = null, webhook = null) {
413+
const response = await this.getAPIRequest('/similarweb', {
414+
query: toArray(query),
415+
fields: fields ? toArray(fields) : null,
416+
async: asyncRequest,
417+
ui: ui,
418+
webhook: webhook,
419+
});
420+
return this.handleAsyncResponse(response, asyncRequest);
421+
}
422+
423+
async companyWebsitesFinder(query, fields = null, asyncRequest = false, ui = null, webhook = null) {
424+
const response = await this.getAPIRequest('/company-website-finder', {
425+
query: toArray(query),
426+
fields: fields ? toArray(fields) : null,
427+
async: asyncRequest,
428+
ui: ui,
429+
webhook: webhook,
430+
});
431+
return this.handleAsyncResponse(response, asyncRequest);
432+
}
411433
}
412434

413435
module.exports = Outscraper;

outscraper.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,22 @@ declare module 'outscraper' {
281281
query: string | string[],
282282
asyncRequest?: boolean
283283
): Promise<any | AsyncResponse>;
284+
285+
similarweb(
286+
query: string | string[],
287+
fields?: string | string[] | null,
288+
asyncRequest?: boolean,
289+
ui?: boolean | null,
290+
webhook?: string | null
291+
): Promise<any | AsyncResponse>;
292+
293+
companyWebsitesFinder(
294+
query: string | string[],
295+
fields?: string | string[] | null,
296+
asyncRequest?: boolean,
297+
ui?: boolean | null,
298+
webhook?: string | null
299+
): Promise<any | AsyncResponse>;
284300
}
285301
}
286302

test-async-false.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ async function testAllServices() {
9393
console.log('\nTesting appStoreReviews...');
9494
console.log(await outscraper.appStoreReviews('id686449807', 1, 'mosthelpful', null, '', false));
9595

96+
console.log('\nTesting similarweb...');
97+
console.log(await outscraper.similarweb('apple.com', null, false, null, null));
98+
99+
console.log('\nTesting companyWebsitesFinder...');
100+
console.log(await outscraper.companyWebsitesFinder('Apple Inc', null, false, null, null));
101+
96102
console.log('\nAll tests completed!');
97103
} catch (error) {
98104
console.error('Error:', error);

test-async-true.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ async function testAllServices() {
9393
console.log('\nTesting appStoreReviews...');
9494
console.log(await outscraper.appStoreReviews('id686449807', 1, 'mosthelpful', null, '', true));
9595

96+
console.log('\nTesting similarweb...');
97+
console.log(await outscraper.similarweb('apple.com', null, true, null, null));
98+
99+
console.log('\nTesting companyWebsitesFinder...');
100+
console.log(await outscraper.companyWebsitesFinder('Apple Inc', null, true, null, null));
101+
96102
console.log('\nAll tests completed!');
97103
} catch (error) {
98104
console.error('Error:', error);

0 commit comments

Comments
 (0)