<commit_before>var request = require('request');
var cheerio = require('cheerio');
var fs      = require('fs');
var target  = 'http://www.twitter.com/' + process.argv[2];

request(target, function(err, res, body) {
  if (!err && res.statusCode == 200) {
    var tweets = [];
    var filer = fs.createWriteStream('tweets.txt');
    var $ = cheerio.load(body, {
      ignoreWhitespace: true,
      lowerCaseTags: true
    });
    $('.tweet-text').each(function(i, element) {
      tweets[i] = $(this).text();
    });
    tweets.forEach(function(i) {
      console.log(i + '\n');
      filer.write(i + '\n --- \n');
    });
  }
});<commit_msg>Updated tweetget to take an optional third argument, -w, for writing to tweets.txt.<commit_after>var request = require('request');
var cheerio = require('cheerio');
var fs      = require('fs');
var target  = 'http://www.twitter.com/' + process.argv[2];
var flag    = process.argv[3];

request(target, function(err, res, body) {
  if (!err && res.statusCode == 200) {
    var tweets = [];
    if (flag == '-w') {
      var filer = fs.createWriteStream('tweets.txt');
    }
    var $ = cheerio.load(body, {
      ignoreWhitespace: true,
      lowerCaseTags: true
    });
    $('.tweet-text').each(function(i, element) {
      tweets[i] = $(this).text();
    });
    tweets.forEach(function(i) {
      if (!flag) {
        console.log(i + '\n ---');
      } else if (flag == '-w') {
        filer.write(i + '\n --- \n');
      }
    });
  }
});
{'fraction_non_alphanumeric': 0.20391627278865632, 'fraction_numerical': 0.006076975016880486, 'mean_word_length': 2.6592592592592594, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2297676', 'n_tokens_mistral': 518, 'n_tokens_neox': 511, 'n_words': 108}