Scrapy+phantonjs 爬去速度过慢?

2017-01-27 16:22:37 +08:00
 yangjiaronga
scrapy 运行日志
**************ProxyMiddleware not pass************171.38.66.23:9999
2017-01-26 23:05:38 [selenium.webdriver.remote.remote_connection] DEBUG: POST http://127.0.0.1:57234/wd/hub/session {"desiredCapabilities": {"browserName": "phantomjs", "version": "", "platform": "ANY", "javascriptEnabled": true}, "requiredCapabilities": {}}
2017-01-26 23:05:38 [selenium.webdriver.remote.remote_connection] DEBUG: Finished Request
2017-01-26 23:05:38 [selenium.webdriver.remote.remote_connection] DEBUG: POST http://127.0.0.1:57234/wd/hub/session/e5c0aeb0-e3d8-11e6-a629-15e39efe8c5a/url {"url": "Matweb Engineering Materials List", "sessionId": "e5c0aeb0-e3d8-11e6-a629-15e39efe8c5a"}

phantonjs 中间件代码:
def process_request(self, request, spider):
driver = webdriver.PhantomJS(executable_path=r"/Users/apple/phantomjs-2.1.1-macosx/bin/phantomjs")
driver.get(request.url)
body = driver.page_source
print ("访问"+request.url)
return HtmlResponse(driver.current_url, body=body, encoding='utf-8', request=request)


每次执行到 selenium.webdriver.remote.remote_connection 。 都会卡上 20s , 请问这是为什么?
2323 次点击
所在节点    Python
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/337161

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX