Skip to content

Instantly share code, notes, and snippets.

@bynaki
Last active January 24, 2016 18:19
Show Gist options
  • Save bynaki/de67ce28df2252595d9c to your computer and use it in GitHub Desktop.
Save bynaki/de67ce28df2252595d9c to your computer and use it in GitHub Desktop.
Node.js :: node.js 에서 jquery 사용 :: jsdom

:origin:

Node.js :: node.js 에서 jquery 사용 :: jsdom

var jsdom = require('jsdom');
var jquery = require('jquery');

jsdom.env({
  url: 'http://news.ycombinator.com',
  src: [],
  done: function (err, window) {
    var $ = jquery(window);
    $('td.title:not(:last) a').each(function () {
      console.log(' -', $(this).text());
    });
  }
});
{"noteId":"15140a05e4d-7c91413b","main":"15140a05e4d-7c91413b.md","title":"Node.js :: node.js 에서 jquery 사용 :: jsdom"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment