<commit_before>var express = require('express');
var fs      = require('fs');
var request = require('request');
var cheerio = require('cheerio');
var sleep 	= require('sleep');
var app     = express();

app.get('/scrape', function(req, res){
	url = 'http://www.seattlefoodtruck.com/index.php/trucks/314-pie/';

	request(url, function(error, response, html) {
		if (!error) {
			var $ = cheerio.load(html);

			sleep.sleep(1);

			var name;
			var stuff;
			var json = {
				name: "",
				cuisine: "",
				payment: "",
				description: "",
				schedule: [
					{
						monday: {
							address: "",
							coordinates: [
								null,
								null
							],
							open: "",
							close: ""
						},
						tuesday: {
							address: "",
							coordinates: [
								null,
								null
							],
							open: "",
							close: ""
						},
						other: ""
					}
				],
				contact: [
					{
						facebook: "",
						twitter: "",
						twitter_handle: "",
						website: ""
					}
				]
			};

			name = $(".entry-title").text();
      json.name = name;

			var cells = $(".entry-content td");
			console.log("CELLS COUNT: ", cells.length); // 3
			cells.each(function(index, value) {
				console.log("CELL[" + index + "]: ", $(this).text());
			});




      // console.log(json);
			// console.log("json.name: ", json.name);
			// console.log("rows: \n", rows);


			// links.each(function() {
		  //       // var links = $(this);
      //       var href = this.href;
		  //       // title = links.children().first().text();
		  //       // release = links.children().last().children().text();
      //<commit_msg>Pulling cell data by index of adjacent cell header. Gross but it's working.<commit_after>var express = require('express');
var fs      = require('fs');
var request = require('request');
var cheerio = require('cheerio');
var sleep 	= require('sleep');
var app     = express();

app.get('/scrape', function(req, res){
	url = 'http://www.seattlefoodtruck.com/index.php/trucks/314-pie/';

	request(url, function(error, response, html) {
		if (!error) {
			var $ = cheerio.load(html);

			sleep.sleep(1);

			var name, cuisine, payment, description, facebook, twitter, website;
			var stuff;
			var json = {
				name: "",
				cuisine: "",
				payment: "",
				description: "",
				schedule:
					{
						monday: {
							address: "",
							coordinates: [
								null,
								null
							],
							open: "",
							close: ""
						},
						tuesday: {
							address: "",
							coordinates: [
								null,
								null
							],
							open: "",
							close: ""
						},
						other: ""
					},
				contact:
					{
						facebook: "",
						twitter: "",
						twitter_handle: "",
						website: ""
					}

			};

			name = $(".entry-title").text();
      json.name = name;

			var cell_pairs = [];
			var cells = $(".entry-content td");
			console.log("CELLS COUNT: ", cells.length); // 3
			cells.each(function(index, value) {
				console.log("CELL[" + index + "]: ", $(this).text());
				var orig_text = $(this).text();
				var no_newline_text = orig_text.replace(/(\r\n|\n|\r)/gm,"").trim();
				cell_pairs[index] = no_newline_text;
			});
			console.log(cell_pairs);
			
			var cuisine_index = cell_pairs.indexOf("Food Type:") + 1;
			json.cuisine = cell_pairs[cuisine_index];

			var payment_index = cell_pairs.indexOf("Payment:") + 1;
			json.payment = cell_pairs[payment_index];

			var description_index = cell_pairs.indexOf("Description:") + 1;
			json.description = cell_pairs[description_index];

			var facebook_index = cell_pairs.indexOf("Facebook:") + 1;
			json.contact.facebook = cell_pairs[facebook_index];

			var twitter_index = cell_pairs.indexOf("Twitter:") + 1;
			json.contact.twitter 	= cell_pairs[twitter_index];

			var website_index = cell_pairs.indexOf("Website:") + 1;
			json.contact.website 	= cell_pairs[website_index];

      console.log(json);
			// console.log("json.name: ", json.name);
			// console.log("rows: \n", rows);


			// links.each(function() {
		  //       // var links = $(this);
      //       var href = this.href;
		  //       // title = links.children().first().text();
		  //       // release = links.children().last().children().text();
      //
{'fraction_non_alphanumeric': 0.18434163701067616, 'fraction_numerical': 0.0037959667852906285, 'mean_word_length': 2.2012148823082764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6216766', 'n_tokens_mistral': 1865, 'n_tokens_neox': 1345, 'n_words': 260}