<commit_before>/**
 * Created by pupboss on 3/11/16.
 */
'use strict';

var eventproxy = require('eventproxy');
var moment = require('moment');
var charset = require('superagent-charset');
var request = require('superagent');
var constant = require('./constant');
var config = require('../config');
var mail = require('../utility/mail');

charset(request);

var base_url_index = 2;

var normal_agent = function (u_id, passwd, target, callback) {

  get_cookie(u_id, passwd, function (err, cookie) {
    if (err) {
      return callback(err, null);
    } else {
      get_dom(target, cookie, function (err, final) {
        return callback(err, final);
      })
    }
  });
};

var get_cookie = function (u_id, passwd, callback) {
  request
    .post(constant.urls[base_url_index] + 'j_acegi_security_check')
    .send('j_username=' + u_id)
    .send('j_password=' + <PASSWORD>)
    .timeout(3000)
    .set('Accept', 'application/json')
    .set('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36')
    .charset('gbk')
    .end(function(err, res) {
      if (err) {
        return callback(constant.cookie.net_error, null);
      }
      var result = res.redirects[0];
      if (result.indexOf('frameset.jsp') > 0) {
        result = result.replace(constant.urls[base_url_index] + 'frameset.jsp;jsessionid=', '');
        return callback(null, result);<commit_msg>Change default url to index 4<commit_after>/**
 * Created by pupboss on 3/11/16.
 */
'use strict';

var eventproxy = require('eventproxy');
var moment = require('moment');
var charset = require('superagent-charset');
var request = require('superagent');
var constant = require('./constant');
var config = require('../config');
var mail = require('../utility/mail');

charset(request);

var base_url_index = 4;

var normal_agent = function (u_id, passwd, target, callback) {

  get_cookie(u_id, passwd, function (err, cookie) {
    if (err) {
      return callback(err, null);
    } else {
      get_dom(target, cookie, function (err, final) {
        return callback(err, final);
      })
    }
  });
};

var get_cookie = function (u_id, passwd, callback) {
  request
    .post(constant.urls[base_url_index] + 'j_acegi_security_check')
    .send('j_username=' + u_id)
    .send('j_password=' + <PASSWORD>)
    .timeout(3000)
    .set('Accept', 'application/json')
    .set('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36')
    .charset('gbk')
    .end(function(err, res) {
      if (err) {
        return callback(constant.cookie.net_error, null);
      }
      var result = res.redirects[0];
      if (result.indexOf('frameset.jsp') > 0) {
        result = result.replace(constant.urls[base_url_index] + 'frameset.jsp;jsessionid=', '');
        return callback(null, result);
{'fraction_non_alphanumeric': 0.16414835164835165, 'fraction_numerical': 0.026442307692307692, 'mean_word_length': 3.5232919254658386, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '7614581', 'n_tokens_mistral': 1037, 'n_tokens_neox': 983, 'n_words': 222}