【发布时间】:2018-02-03 03:11:45
【问题描述】:
所以我有一段看起来像这样的 HTML:
<html>
<body>
<script>
var foo = {
bar: []
};
</script>
</body>
</html>
我正在尝试使用 PhantomJS 来提取 foo.bar 的值。我该怎么做?到目前为止,我知道我的结构是这样的:
var webPage = require('webpage');
var page = webPage.create();
page.open(MY_URL, function(status) {
var foo = page.evaluate(function(){
//gets javascript from the HTML in the response
// and extracts foo from there
});
});
console.log(someVar);
phantom.exit();
【问题讨论】:
标签: javascript jquery node.js web-scraping phantomjs