我想阅读 2 个不同的文本文件,keys.txt 文件和 proxies.txt 文件。读取 keys.txt 时启动一个函数并读取 proxies.txt 以在该函数中添加一些内容。
var LineByLineReader = require('line-by-line'),
lr = new LineByLineReader('keys.txt');
ls = new LineByLineReader('proxies.txt')
lr.on('line', function (line) {
console.log(chalk.blueBright("Going next to: " + line))
lr.pause();
x = x+1 //ignore this, it is my max readers per second
if(x<=10){
try {
(async () => {
ls.on('line', proxy) .then(proxy => {
const browser = await puppeteer.launch({headless: true, devtools: false,
args: [`--proxy-server=http://${proxy}`]
})
const page = await browser.newPage()
})})} catch(err) {throw(err)}}})
我需要在我的代码中使用 proxies.txt 中的行,但是我不能这样做,因为它启动了 2 个单独的函数。(如果我使用ls.on('line', function proxy { CODE })
)。由于某种原因,这条线 ls.on('line', proxy) .then(proxy => {
似乎无法正常工作。