0

response函数中有什么page.on

在第 17 行的“ https://github.com/vdrmota/actor-twitter-scraper/blob/master/src/scraper.js ”示例中,您检查response.url包含"/timeline/profile/".

page.url()https://twitter.com/${handle}/with_replies。_ 那么为什么要在第 17 行检查 URL 包含的内容"/timeline/profile/"呢?

4

1 回答 1

0

page.on('response', handler)每次页面收到​​对其请求之一的响应时,都会调用处理函数。它可以是主文档,也可以是各种 CSS 文件、图像、脚本等。因此,URL 检查只过滤掉相关响应。

有关更多信息,请参阅 Puppeteer 文档:https ://pptr.dev/#?product=Puppeteer&show=api-event-response

于 2020-03-03T15:13:02.867 回答