more fixes to depth logic

This commit is contained in:
biglyderv 2025-01-31 20:08:22 -05:00
parent a704c28b2f
commit e03a05d07f

10
site.js
View file

@ -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));
}