From e03a05d07f72f8efca498cbdb8954c310090c91d Mon Sep 17 00:00:00 2001 From: biglyderv Date: Fri, 31 Jan 2025 20:08:22 -0500 Subject: [PATCH] more fixes to depth logic --- site.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/site.js b/site.js index ab7896c..2717dca 100644 --- a/site.js +++ b/site.js @@ -9,7 +9,7 @@ let route = process.env.route || './test.txt'; let pageLimit = process.env.pageLimit || Infinity; let hh; -async function urlCollector(url, path, file) { +async function urlCollector(url, path, file, useLimit) { if (path != 'following') return []; let data; @@ -35,7 +35,7 @@ async function urlCollector(url, path, file) { h = u.toString(); } urls.push(h) - if (urls.length >= pageLimit) return urls; + if (useLimit && urls.length >= pageLimit * 40) return urls; }) return urls; @@ -58,7 +58,7 @@ async function siteCollector(user, path, site, useLimit) { let out = []; if (site == 'file') { - return await textCollector(user, path, route); + return await textCollector(user, path, route, useLimit); } if (site == 'url') { @@ -128,8 +128,8 @@ async function siteCollector(user, path, site, useLimit) { let d = process.env.depth || 1; for (let i = 1; i < d; i++) { users = [...new Set(users)]; - let j = 0; - for (let u of users) { + let tempSet = [...users]; + for (let u of tempSet) { users = users.concat(await siteCollector(u, 'followers', site, true)); users = users.concat(await siteCollector(u, 'following', site, true)); }