如何使用 casperjs 和 phantom 接受 gzip 内容?
How to accept gzip content with casperjs and phantom?
我注意到 casperjs 无法读取页面,当我添加 "Accept-Encodeing" : "gzip, deflate" 时。在 casperjs 请求中 headers .
casperjs 似乎不支持 gzip 。我搜索了很多,但我不确定该怎么做。
也许我需要这样做:
casper.on("page.download"){
//decode gzip
}
但我不知道该怎么做?你能帮我吗 !谢谢
这是 phantom 中的已知错误,已有 2 年多了。不太可能在不久的将来修复。
- 在不修改 accept-encoding header 的情况下,Phantomjs 2 将添加 "accept-encoding=gzip" header(不过,这不会显示在 page.onResourceRequested 回调中),并且可以成功解压 gzip 内容。
- 当我们在请求头中添加 "accept-encoding=gzip" 时,Phantomjs 2 无法解压它。
https://github.com/ariya/phantomjs/issues/13621
请注意,我会把它写成评论,但由于我的用户级别,我无法对此发表评论 post。不管出于什么原因我必须有50声望。
我注意到 casperjs 无法读取页面,当我添加 "Accept-Encodeing" : "gzip, deflate" 时。在 casperjs 请求中 headers .
casperjs 似乎不支持 gzip 。我搜索了很多,但我不确定该怎么做。
也许我需要这样做:
casper.on("page.download"){
//decode gzip
}
但我不知道该怎么做?你能帮我吗 !谢谢
这是 phantom 中的已知错误,已有 2 年多了。不太可能在不久的将来修复。
- 在不修改 accept-encoding header 的情况下,Phantomjs 2 将添加 "accept-encoding=gzip" header(不过,这不会显示在 page.onResourceRequested 回调中),并且可以成功解压 gzip 内容。
- 当我们在请求头中添加 "accept-encoding=gzip" 时,Phantomjs 2 无法解压它。
https://github.com/ariya/phantomjs/issues/13621
请注意,我会把它写成评论,但由于我的用户级别,我无法对此发表评论 post。不管出于什么原因我必须有50声望。