thresholds

This commit is contained in:
biglyderv 2025-02-01 13:24:37 -05:00
parent d2074f73c9
commit 8531c671f4

View file

@ -9,6 +9,7 @@ let route = process.env.route || './test.txt';
let pageLimit = process.env.pageLimit || Infinity;
let blacklist = (process.env.blacklist + '').split(',') || [];
let greylist = (process.env.greylist + '').split(',') || [];
let threshold = process.env.threshold || 100;
let rel = (process.env.rel == 'relative');
let hh;
let percent = 0;
@ -79,6 +80,8 @@ async function urlCollector(url, path, file, useLimit, data2) {
if (!data2[url]) data2[url] = { following: [], followers: [] };
data2[url][path] = [...new Set(urls)];
data2[url][path].sort((x,y) => ((new URL(x).host == new URL(url).host) ? 1 : 0) - ((new URL(y).host == new URL(url).host) ? 1 : 0))
return data2[url][path];
}
@ -260,7 +263,12 @@ async function siteCollector(user, path, site, useLimit, data2) {
users = tempSet.concat(await rounder(tempSet, data, true));
users = [...new Set(users)];
}
let oldLength = Object.keys(data).length;
for (let uf of users) {
if (Object.keys(data).length > oldLength * threshold) {
break;
}
let u = data[uf];
if (!u) {
data[uf] = {following: [], followers: []}