в фале proxy.txt
Moscow:
91.243.188.184
91.243.188.114
91.243.188.30
91.243.188.137
SPB:
109.120.128.178
109.120.128.179
109.120.128.180
New IP Moscow:
83.166.240.184
83.166.241.9
83.166.241.120
port: 7951
login/pas: In the account https://www.oplata.info/info/delivery.asp
код парсера данного файла:
const filedata = fs.readFileSync('proxy.txt', 'utf-8');
const proxyData = filedata.split(/\s*?\n+\s*/).reduce(
(acc, line)=>{
if( /\w+:$/.test(line)){
acc.location = line;
}else if( /port:\s*\d+/.test(line)){
acc.port = line.replace(/\D+/g,'');
}else if( /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/.test(line)){
acc.list.push({
ip: line,
location: acc.location
});
}
return acc;
},
{
list:[],
location: undefined,
port: undefined
}
);
const targetProxy = proxyData.list.map(item => item.ip + ':' + proxyData.port);
console.log(targetProxy)
// 91.243.188.184:7951
// 91.243.188.114:7951
// 91.243.188.30:7951
// 91.243.188.137:7951
// 109.120.128.178:7951
// 109.120.128.179:7951
// 109.120.128.180:7951
// 83.166.240.184:7951
// 83.166.241.9:7951
// 83.166.241.120:7951
тест на jsfiddle