Tag: scrape

Phantomjs刮网页function无法正常工作

我正在使用phantomjs来学习如何抓取一个网页,到目前为止我已经开发了以下代码..我知道我能够连接到该网站,但我无法从表中获取数据…我走在正确的轨道上? 我的目标是从本网站的表格中删除数据。 我也明白我需要使用includeJs或者injectJs来等待表加载其他我会抓一个空的html页面。 我试图将这些概念放在一起,但现在已经停留了3天以上..请给出一些指导.. var page = require(‘webpage’).create(); console.log(‘Welcome to scraping…’); page.open(‘http://www.inc.com/inc5000/index.html’, function(status) { page.includeJs(“http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js”, function() { if (status !== ‘success’) { console.log(‘Unable to access network’); } else { var ua = page.evaluate(function() { var DATA = []; var res= document.getElementById((this).find(‘td’)).eq(0).text(); console.log(res); //**See output below for what is happening here** $(‘tr.ng-scope’).each(function(){ var $tds = $(this).find(‘td’); […]