New Text Document
New Text Document
New Text Document
console.log(moment().format("YYYY-MM-DD HH:mm:ss"));
StartProgram();
setInterval(() => {
console.log(moment().format("YYYY-MM-DD HH:mm:ss"))
StartProgram();
}, Const.scrapperTime);
// console.log('2.js executions started with all parameters.');
}
let ClusterRecivedFromScrapper;
Const.scrapeType = 'm';
if (process.argv[3]) {
ClusterRecivedFromScrapper = parseInt(process.argv[3])
}
}
else {
Const.scrapeType = 'n';
}
try {
const ScrapeLoop = async (event) => {
return new Promise(async (resolve, reject) => {
let isResolved = false;
while (isResolved == false) {
let data = await ScrapeEvent(event);
if (data == true) {
isResolved = true;
}
}
return resolve(true);
})
}
const StartProgram = async () => {
//Getting Proxies
const { data: dataProxies, status: statusProxies } = await fetchProxies();
if (statusProxies == 200) {
proxy.proxies = dataProxies;
}
//Getting UserAgents
const { data: dataUserAgents, status: statusAgents } = await fetchAgents();
if (statusAgents == 200) {
agent.UserAgent = dataUserAgents;
}
if (Const.scrapeType == 'm') {
console.log(dataFinal.length,"sssssss");
//convert the chunk data of each 200 event
let e = 1;
for (let event of dataFinal) {
console.log(e);
const dataG = await ScrapeLoop(event);
console.log(dataG, "completed");
if (event.isMapLoaded == true) {
}
e += 1;
failedProxies.failedProxies = [];
}
console.log(moment().format("YYYY-MM-DD HH:mm:ss"), "END")
}
else {
}
}
}
console.log(moment().format("YYYY-MM-DD HH:mm:ss"));
StartProgram();
}
catch (e) {
process.abort()
}
import axios from 'axios';
import https from 'https'
import Const from './settings/const.js';