<commit_before>'use strict';

var wi = require('wiki-infobox');

var reqTry = 0;
var noe = function(title, cb) {
  reqTry++;
  wi(title, 'en', function(err, infobox) {
    if (err && title.indexOf('series') === -1) {
      // There's an error but we didn't add 'TV SERIES' to the title
      noe(title + ' (TV series)', cb);
      return;
    } else if (err) {
      cb(new Error('No episodes found :('));
      return;
    }

    console.log(title);
    var episodes = infobox.num_episodes;

    if (Array.isArray(infobox.num_episodes)) {
      episodes = infobox.num_episodes.filter(function(element) {
        var parsed = parseInt(element.value, 10);

        return element.type === 'text' &&
          typeof parsed === 'number' &&
          !Number.isNaN(parsed);
      }).pop();
    }

    episodes = episodes && episodes.value ? parseInt(episodes.value, 10) : 0;
    cb(err, episodes);
  });<commit_msg>:penguin: redirect wiki page fixed<commit_after>'use strict';

var wi = require('wiki-infobox');

var reqTry = 0;
var noe = function(title, cb) {
  reqTry++;
  wi(title, 'en', function(err, infobox) {
    if ((err && title.indexOf('series') === -1) || typeof infobox.num_episodes === 'undefined') {
      // There's an error but we didn't add 'TV SERIES' to the title
      noe(title + ' (TV series)', cb);
      return;
    } else if (err) {
      cb(new Error('No episodes found :('));
      return;
    }

    console.log(title);
    var episodes = infobox.num_episodes;

    if (Array.isArray(infobox.num_episodes)) {
      episodes = infobox.num_episodes.filter(function(element) {
        var parsed = parseInt(element.value, 10);

        return element.type === 'text' &&
          typeof parsed === 'number' &&
          !Number.isNaN(parsed);
      }).pop();
    }

    episodes = episodes && episodes.value ? parseInt(episodes.value, 10) : 0;
    cb(err, episodes);
  });
{'fraction_non_alphanumeric': 0.16367476240760295, 'fraction_numerical': 0.007391763463569166, 'mean_word_length': 2.7673956262425445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '840225', 'n_tokens_mistral': 650, 'n_tokens_neox': 625, 'n_words': 155}