<commit_before>request = require("request");

var quote = function(req,res){

  url = "http://finance.google.com/finance/info?client=ig&q="+req.params.symbol;

  request(url, function (error, response, html) {
    if (!error) {
      res.send(html);
    }
  });
}

var getSymbol = function(req,res){

  url = "https://www.google.ca/finance?q="+req.params.company;

  request(url, function (error, response, html) {
    if (!error) {
      // if "id=rc-1" is in the page, it means that there are multiple results
      var index = html.search("id=rc-1");
      var symbol = [];
      var symbol_string = "";

      // in this case we look at the symbol of the first result
      if (index != -1){

        while(true){
          index++;
          if (html[index]=="&"){
            break;
          }
        }

        index--;

        while(true){
          if (html[index]=="="){
            break;
          }
          symbol.push(html[index]);
          index--;
        }<commit_msg>tail case to scraper<commit_after>request = require("request");

var quote = function(req,res){

  url = "http://finance.google.com/finance/info?client=ig&q="+req.params.symbol;

  request(url, function (error, response, html) {
    if (!error) {
      res.send(html);
    }
  });
}

var getSymbol = function(req,res){

  url = "https://www.google.ca/finance?q="+req.params.company;

  request(url, function (error, response, html) {
    if (!error) {
      // if "id=rc-1" is in the page, it means that there are multiple results
      var index = html.search("id=rc-1");
      var symbol = [];
      var symbol_string = "";

      // if there's no results, just send back null.
      if(html.search("produced no matches")!=-1){
        res.send("null");
      }

      // in this case we look at the symbol of the first result
      if (index != -1){

        while(true){
          index++;
          if (html[index]=="&"){
            break;
          }
        }

        index--;

        while(true){
          if (html[index]=="="){
            break;
          }
          symbol.push(html[index]);
          index--;
        }
{'fraction_non_alphanumeric': 0.16314057357780912, 'fraction_numerical': 0.003291020216267043, 'mean_word_length': 1.9596662030598053, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '3155642', 'n_tokens_mistral': 679, 'n_tokens_neox': 660, 'n_words': 163}