Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Puppeteer 如何检测URL列表中的重复值并停止迭代_Puppeteer - Fatal编程技术网

Puppeteer 如何检测URL列表中的重复值并停止迭代

Puppeteer 如何检测URL列表中的重复值并停止迭代,puppeteer,Puppeteer,我正在尝试使用puppeter和cron来抓取一个网站。它的工作正常,除了我不能想出如何停止程序执行,如果重复的url被检测到 以下是我的项目的伪代码: // target = grab the <a> tag from site // page.goto(target) // grab all data // save it to the file //target=从站点抓取标记 //第页转到(目标) //抓取所有数据 //将其保存到文件中 虽然这段代码运行正常,但当

我正在尝试使用
puppeter
cron
来抓取一个网站。它的工作正常,除了我不能想出如何停止程序执行,如果重复的url被检测到

以下是我的项目的伪代码:

// target = grab the <a> tag from site

// page.goto(target)

// grab all data

// save it to the file 
//target=从站点抓取标记
//第页转到(目标)
//抓取所有数据
//将其保存到文件中
虽然这段代码运行正常,但当我在scheduler/cron上运行这段脚本时,我希望以某种方式检测源站点的标记是否已被刮除,并在每次运行cron函数时停止代码再次刮除旧链接并将重复数据保存到字段中

谢谢你抽出时间