change args

This commit is contained in:
biglyderv 2025-01-31 17:39:47 -05:00
parent e2aa17980b
commit 9a8111224b

11
site.js
View file

@ -4,14 +4,15 @@ import { rankCalc } from "./rank.js";
let cache = {};
let site = process.env.site || 'darflen';
let route = process.env.route || './test.txt';
let hh;
async function textCollector(word, path, file) {
if (!hh) hh = await readFile(file,'utf8');
if (!hh) hh = await readFile(file, 'utf8');
hh = hh.toLowerCase();
let words = hh.split(/[\n.]+/g).filter(x => word.length == 0 || ` ${x} `.includes(` ${word} `)) ;
let words = hh.split(/[\n.]+/g).filter(x => word.length == 0 || ` ${x} `.includes(` ${word} `));
words = words.join(' ').split(/[^a-zA-Z0-9']+/g);
words = [...new Set(words)];
return words;
@ -22,8 +23,8 @@ async function siteCollector(user, path, site) {
let i = 1;
let out = [];
if (site.startsWith('text_')) {
return await textCollector(user, path, site.split('text_')[1]);
if (site == 'file') {
return await textCollector(user, path, route);
}
while (true) {
@ -96,7 +97,7 @@ async function siteCollector(user, path, site) {
break;
}
}
data[u] = {followers: [], following: []};
data[u] = { followers: [], following: [] };
p.push(async function (k) {
let j1 = await siteCollector(u, 'followers', site);