在不中断会话的情况下将 deathbycaptcha 与 phantomjs 一起使用

Using deathbycaptcha with phantomjs without interrupting sessions

考虑到 PhantomJS 不完全是 node.js(所以像 deathbycaptcha2 这样的模块)因为它们使用本机请求而被淘汰,是否可以简单地打开 webpage 的另一个实例并且使用它向验证码 API 发送 POST 请求而不影响其他页面实例?

这个新的 page.open() 会保留第一页收集的 cookie 吗?

Will this new page.open() retain cookies collected by the first page?

是的,每个 PhantomJS 进程只有一个 CookieJar。因此,您创建的每个 page 共享相同的 cookie。将这些 page 实例视为 windows 或传统浏览器中的选项卡。

[I]s it possible to simply open another instance of webpage and use it to send POST requests to the captcha API without affecting the other page instance?

这并不容易,因为 cookie 是共享的。如果您不访问相同的页面,您可以安全地创建第二个实例。如果你想在第二个实例中访问同一个页面,那么你可以通过 child_process module(例如 execFile)启动第二个 PhantomJS 进程。

Considering that PhantomJS isn't exactly node.js [...]

是的,但是 PhantomJS 和 node.js 之间有几个桥梁,例如 phantom, node-phantom, nightmare 等。您可以使用它们与 PhantomJS 交互并另外调用您想要的节点模块。