1

I'm doing a simple get request, but my code is only returning a "chunk" of the webpage html. I thought 'request' is supposed to take care of the buffering and return a single string?

var request = require('request');
    request("EXAMPLE-URL", function (error, response, body) {
    if (!error && response.statusCode == 200) {
         console.log(body);
    }
});
mnort9
  • 1,810
  • 3
  • 30
  • 54
  • Yes, body should include everything. The request usually returns the second half of the page html, ending with ` – mnort9 Jan 17 '13 at 21:56
  • Check in your browser's developer tools -- the response you see under "Network" is all `request` can get you. If the content of the page has changed since that -- any new or removed elements -- the alterations are performed post-request via DOM manipulation. – Jonathan Lonowski Jan 17 '13 at 22:03
  • There are over 100 different requests. If the content is not there, I can't retrieve using request? – mnort9 Jan 17 '13 at 22:15
  • Related questions you may find useful: http://stackoverflow.com/q/5441265/, http://stackoverflow.com/q/12403833/. – Jonathan Lonowski Jan 17 '13 at 22:56
  • What you seem to need is a "[headless browser](http://blog.arhg.net/2009/10/what-is-headless-browser.html)." `request` alone isn't enough for this. There are a [few available for Node.js](https://npmjs.org/browse/keyword/headless), such as [PhantomJS](http://phantomjs.org/) and [zombie](http://zombie.labnotes.org/). – Jonathan Lonowski Jan 17 '13 at 23:13

0 Answers0