网页爬虫 - java爬虫如何解析JavaScript
大家讲道理
大家讲道理 2017-04-17 17:29:23
0
6
401

用java爬取JavaScript动态生成的页面,怎么解析js?用rhino?phantomjs?还是其他的什么?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(6)
Peter_Zhu

phantomJS can.

迷茫

Unless it is very complex front-end logic (for example, there is a lot of logic to calculate tokens), it is not recommended to simulate the execution of js
If it is dynamically loaded data, it would be simpler to just get json directly#🎜🎜 #

刘奇

There is a jar package for parsing js scripts, but I can’t remember the specific package.

大家讲道理

As far as crawlers are concerned, it is not advisable to directly simulate the browser to parse Javascript. You can directly capture and generate the json of the corresponding web page to achieve this.

迷茫

If you use java, you can try Selinium’s WebDriver. If you use js, just use phantomjs

大家讲道理

Refer to this document
How to crawl data dynamically generated by JS? http://doc.shenjianshou.cn/de...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template