Scraping Node.js: Getting text from H2 header

Ok so for fun I decided to scrape all the users who go to my college who are signed up on the website moodle.

This is the program I made with Node.js and cheerio that scrapes the site, but I can not seem to get the text that is inside the H2 tag.

This is the website I am scraping from, http://moodle.ramapo.edu/user/profile.php?id=2101 All I need to do is just change the ID number and it loops through every student.

     var request = require('request'),
     cheerio = require('cheerio');
     urls = [];

     //For just single page, eventually will loop through each page.
     request('http://moodle.ramapo.edu/user/profile.php?id=2101', function(err, resp, body){
     if (!err && resp.statusCode == 200) {
          var $ = cheerio.load(body);
          $('h2.main', '#yui_3_9_1_2_1410303448188_167').each(function(){
              //Not sure how to retrieve just the text name of person
          });
      console.log(urls);
      };
 });

How do I just select the text inside the H2 tag so that I can log all of them to my console?

That's not the way I'd go about it. Below is a code snippet that should help you out, all you'll need to do is wrap it in a loop and iterate through the urls you want to scrape. I'd also suggest you check out this tutorial Scraping the Web With Node.js

var express = require('express');
var request = require('request');
var cheerio = require('cheerio');
var app     = express();

app.get('/scrape', function(req, res){

  url = 'http://moodle.ramapo.edu/user/profile.php?id=2101';

  request(url, function(error, response, html){
        if(!error){
              var $ = cheerio.load(html);
              var name;
              $('.main').filter(function(){
                var data = $(this);
                name = data.text();
                console.log("name = " + name);
          })
        }
    res.send('Check your console!')
  })
})

app.listen('8081')
exports = module.exports = app;