fail
This commit is contained in:
parent
a92a619684
commit
6cd3593483
1 changed files with 11 additions and 5 deletions
16
site.js
16
site.js
|
@ -7,8 +7,8 @@ let cache = {};
|
|||
let site = process.env.site || 'darflen';
|
||||
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 blacklist = (process.env.blacklist + '').split(',') || [];
|
||||
let greylist = (process.env.greylist + '').split(',') || [];
|
||||
let hh;
|
||||
|
||||
async function urlCollector(url, path, file, useLimit, data2) {
|
||||
|
@ -75,20 +75,23 @@ async function textCollector(word, path, file) {
|
|||
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)];
|
||||
|
||||
if (!data2[word]) data2[word] = { following: [], followers: [] };
|
||||
data2[word][path] = words;
|
||||
return words;
|
||||
}
|
||||
|
||||
async function siteCollector(user, path, site, useLimit, dat) {
|
||||
async function siteCollector(user, path, site, useLimit, data2) {
|
||||
let users = [];
|
||||
let i = 1;
|
||||
let out = [];
|
||||
|
||||
if (site == 'file') {
|
||||
return await textCollector(user, path, route);
|
||||
return await textCollector(user, path, route, data2);
|
||||
}
|
||||
|
||||
if (site == 'url') {
|
||||
return await urlCollector(user, path, route, useLimit, dat);
|
||||
return await urlCollector(user, path, route, useLimit, data2);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
@ -131,6 +134,9 @@ async function siteCollector(user, path, site, useLimit, dat) {
|
|||
console.log(`User ${user} has ${i} pages calculated`);
|
||||
}
|
||||
out = out.concat(...users);
|
||||
|
||||
if (!data2[user]) data2[user] = { following: [], followers: [] };
|
||||
data2[user][path] = out;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue