<commit_before>var request = require('request');
var cheerio = require('cheerio');
var async = require('async');

var spider = function() {
  var self = this;
  request('https://news.ycombinator.com', function(error, response, body) {
    if (!error && response.statusCode == 200) {
      self.getLinks(body)
    }
  })

  this.getLinks = function(html) {
    var $ = cheerio.load(html);
    var links = $('a');
    console.log(links)
  }
}

spider();<commit_msg>Get href from links<commit_after>var request = require('request');
var cheerio = require('cheerio');
var async = require('async');

var spider = function() {
  var self = this;

  this.scrape = function() {
    request('https://news.ycombinator.com', function(error, response, body) {
      if (!error && response.statusCode == 200) {
        self.getLinks(body)
      }
    })
  }

  this.getLinks = function(html) {
    var $ = cheerio.load(html);
    var links = $('a');

    async.map(links.map(function(){
      var href = $(this).attr('href');
      console.log(href)
    }))
  }
}

var scraper = new spider();
scraper.scrape()
{'fraction_non_alphanumeric': 0.177007299270073, 'fraction_numerical': 0.005474452554744526, 'mean_word_length': 3.3019607843137253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3970800', 'n_tokens_mistral': 378, 'n_tokens_neox': 357, 'n_words': 78}