Node Roundup: hotcode, fbgraph, browser

Alex R. Young





node modules scraping social facebook

Node Roundup: hotcode, fbgraph, browser

Posted by Alex R. Young on .

node modules scraping social facebook

Node Roundup: hotcode, fbgraph, browser

Posted by Alex R. Young on .
You can send your node modules and articles in for review through our [contact form](/contact.html) or [@dailyjs](http://twitter.com/dailyjs).


hotcode (License: MIT, npm: hotcode) by Mathias Pettersson is a small Express app that watches for changes on a given path, then reloads an associated app when files

To use it, follow the instructions in the project's README file. When
hotcode is run it'll print out a link to some JavaScript
(it should be -- this will need to be added to your project to get automatic reloading in
the browser.

Projects can be configured in ~/.hotcode so the path
doesn't need to be entered each time hotcode is started.
This can be set per-domain as well.

One of the interesting things about hotcode is it can be run against
practically any app in any language. If you're sick of having to restart
your app and refresh the browser every time you make a change, then
you're going to love this.


fbgraph (GitHub: criso / fbgraph, License: MIT, npm:
fbgraph) by Cristiano Oliveira provides consistent access to the Facebook graph API. According to the author:

All calls will return json. Facebook sometimes decides to just return a string or true or redirects directly to an image.

Given suitable configuration options, people can be authorised using

var graph = require('fbgraph')
  , authUrl = graph.getOauthUrl({
      'client_id':    conf.client_id
    , 'redirect_uri': conf.redirect_uri

Once the Facebook dialog has been displayed,
graph.authorize is called to complete the process and get
the access token.

API calls are made with graph.get or
graph.post, so most of the API is oriented around HTTP

graph.get('zuck', function(err, res) {
  console.log(res); // { id: '4', name: 'Mark Zuckerberg'... }

graph.post(userId + '/feed', wallPost, function(err, res) {
  // returns the post id
  console.log(res); // { id: xxxxx}

This is a clean, well-documented, and well-tested Facebook library,
which is surprisingly refreshing.


browser (License: MIT, npm: browser) by Shin Suzuki is an event-based library for browsing and scraping URLs, whilst maintaining cookies. Requests are built up using
the library's object, and then triggered with .run():

var $b = require('browser');

Building up a sequence of events is possible with the after

var $b = require('browser');


  .after(); // browse after previously registered function


Event callbacks can also be registered:

$b.on('end', function(err, res) {

Now load up jsdom and you'll be able
to scrape faster than you can say "deep-linking lawsuit"!