Node.js使用Node.io进行拼字

Node.js使用Node.io进行拼字,node.js,web-scraping,Node.js,Web Scraping,我正在尝试Node.js获取此页面的所有标题: 我试试这个: var nodeio = require('node.io'); var methods = { input: false, run: function() { this.getHtml('https://www.odesk.com/jobs/braintree/', function(err, $) { //Handle any request / parsing error

我正在尝试Node.js获取此页面的所有标题:

我试试这个:

var nodeio = require('node.io');
var methods = {
    input: false,
    run: function() {
        this.getHtml('https://www.odesk.com/jobs/braintree/', function(err, $) {

            //Handle any request / parsing errors
            if (err) this.exit(err);

            var titles = [], scores = [], output = [];

            //Select all titles on the page
            $('.content').each(function(a) {
                titles.push(a.text); 
            });
this.emit(output);
        });
    }
}

exports.job = new nodeio.Job({timeout:10}, methods);
但结果我一无所获。怎么了


谢谢

您没有准确地遍历标记。而且您对每个的使用都不正确。试试这个:

$('a', '.content h3').each(function(index, a) {console.log($(a).text())});