Getting source of a page after it's rendered in a templating engine?

独自空忆成欢 提交于 2019-12-06 07:19:52

I used jsdom for screen scrapping and the code goes here...

var jsdom = require( 'jsdom' );
jsdom.env( {
url: <give_url_of_page_u_want_to_scarpe>,
scripts: [ "http://code.jquery.com/jquery.js" ],
done: function( error, window ) {
  var $ = window.$;

  // required page is loaded in $....
  //you can write any javascript or jquery code get what ever you want

}
} );
JZL003

I personally love PhantomJS or Selenium, which do exactly that.

The docs/examples should work pretty much out of the box.

if you want to use a nodejs module then you might be interested in this:

https://github.com/sgentle/phantomjs-node

or this:

https://github.com/alexscheelmeyer/node-phantom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!