Skip to content

Commit

Permalink
Fix: MaxListenerExceedWarning when analyzing sitemap (#260)
Browse files Browse the repository at this point in the history
* Fix:MaxListenersExceededWarning with tech analysis

* fix: MaxListenerExceedWarning
  • Loading branch information
ayushnirwal authored Nov 20, 2023
1 parent eafeffb commit 24cbbc1
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ export const analyzeTechnologiesUrlsInBatches = async (
batchSize = 3
): Promise<TechnologyDetailList[]> => {
const spinnies = new Spinnies();
const wappalyzer = new Wapplalyzer();

let report: TechnologyDetailList[] = [];
const wappalyzer = new Wapplalyzer();

for (let i = 0; i < urls.length; i += batchSize) {
const start = i;
const end = Math.min(urls.length - 1, i + batchSize - 1);
await wappalyzer.init();

spinnies.add(`spinner-${i}`, {
text: `Analysing technologies in urls ${start + 1} - ${end + 1} `,
Expand All @@ -48,9 +49,8 @@ export const analyzeTechnologiesUrlsInBatches = async (

const technologyAnalysis = await Promise.all(
urlsWindow.map(async (url) => {
const site = await wappalyzer.open(url);
const results = await site.analyze();
return results.technologies;
const { technologies } = await (await wappalyzer.open(url)).analyze();
return technologies;
})
);

Expand All @@ -59,6 +59,7 @@ export const analyzeTechnologiesUrlsInBatches = async (
spinnies.succeed(`spinner-${i}`, {
text: `Done technology in urls ${start + 1} - ${end + 1} `,
});
await wappalyzer.destroy();
}

return report;
Expand Down

0 comments on commit 24cbbc1

Please sign in to comment.