<commit_before>const request = require('request');
module.exports = {};
var exports = module.exports;
exports.getPlayers = function(nick,callback) {
    console.log("GET PLAYERS BF2");
    var playerlist = new Array();
    request('http://bf2web.game.bf2.us/ASP/searchforplayers.aspx?nick=' + nick + '&where=a&sort=a&debug=txs&transpose=0',function (error, response, body) {
    var collection = body.split("\n");
    console.log(collection);
    var index = collection.indexOf('H\tn\tpid\tnick\tscore')+1;
    if (index > collection.length) {
        return null;
    }
    while (collection[index].startsWith("D")) {
        /*
        if(index==30)
        {
        playerlist.push(collection.length-27+"more players found"+"\n"
        +"to Get a full list of players \n"
        +"<https://battlelog.co/player_search.php?q="+nick+">");
        break;
    }
    */
        //console.log(collection[index]);
        var p = collection[index].split("\t");
        //console.log(p[2],p[3],p[4]);
        p = new exports.player(p[2], p[3], p[4]);
	exports.getrank(p,function(player){
        playerlist.push(player);});

        index++;
    }
    console.log(playerlist);
    callback(playerlist);
	});
};
exports.player = function(pid_, nick_, score_) {
    this.nick = nick_;
    this.pid = pid_;
    this.score = score_;
    this.rank =0;
    this.link =  "<https://battlelog.co/bfhq.php?pid=" + this.pid + ">";
};
exports.str = function(player)
{
 return player.nick+"\t"+player.score+"\t"+player.link;
}
exports.getrank = function(player,callback)
{
    request('http://bf2web.game.bf2.us/ASP/getrankinfo.aspx?pid=' + player.pid +,function (error, response, body) {
	    player.rank=parseInt(body.split('\n')[2].split('\t')[1]);
	    callback(player);
});
}
<commit_msg>better object handling<commit_after>const request = require('request');
module.exports = {};
var exports = module.exports;
exports.getPlayers = function(nick,callback) {
    console.log("GET PLAYERS BF2");
    var playerlist = new Array();
    request('http://bf2web.game.bf2.us/ASP/searchforplayers.aspx?nick=' + nick + '&where=a&sort=a&debug=txs&transpose=0',function (error, response, body) {
    var collection = body.split("\n");
    console.log(collection);
    var index = collection.indexOf('H\tn\tpid\tnick\tscore')+1;
    if (index > collection.length) {
        return null;
    }
    while (collection[index].startsWith("D")) {
        /*
        if(index==30)
        {
        playerlist.push(collection.length-27+"more players found"+"\n"
        +"to Get a full list of players \n"
        +"<https://battlelog.co/player_search.php?q="+nick+">");
        break;
    }
    */
        //console.log(collection[index]);
        var p = collection[index].split("\t");
        //console.log(p[2],p[3],p[4]);
        p = new exports.player(p[2], p[3], p[4]);
	exports.getrank(p.pid,function(rank){
        p.rank=rank;});
	playerlist.push(p);

        index++;
    }
    console.log(playerlist);
    callback(playerlist);
	});
};
exports.player = function(pid_, nick_, score_) {
    this.nick = nick_;
    this.pid = pid_;
    this.score = score_;
    this.rank =0;
    this.link =  "<https://battlelog.co/bfhq.php?pid=" + this.pid + ">";
};
exports.str = function(player)
{
 return player.nick+"\t"+player.score+"\t"+player.link;
}
exports.getrank = function(pid,callback)
{
    request('http://bf2web.game.bf2.us/ASP/getrankinfo.aspx?pid=' + pid +,function (error, response, body) {
	    var rank=parseInt(body.split('\n')[2].split('\t')[1]);
	    callback(rank);
});
}

{'fraction_non_alphanumeric': 0.19331272829446475, 'fraction_numerical': 0.011239112110143298, 'mean_word_length': 3.168618266978923, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 4, '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': '5035065', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1221, 'n_words': 192}