<commit_before>import axios from "axios";
import cheerio from "cheerio";
import Event from "./event";
const debug = require("debug")("bot:nissan-stadium");

class NissanStadium{

  constructor(){
    this.url = "http://www.nissan-stadium.jp/calendar/index.php";
  }

  async getEvents(){
    const html = await this.getHtml();
    return this.parseHtml(html);
  }

  async getMajorEvents(){
    const events = await this.getEvents();
    return events.filter((i) => { return /(スタジアム|競技場|フィールド)/.test(i.where) });
  }

  async getHtml(){
    debug(`get ${this.url}`);
    return (await axios.get(this.url)).data;
  }

  parseHtml(html){
    const $ = cheerio.load(html);
    const m = $("#areatitle01 h3").text().match(/(\d{4})年(\d?\d)月/);
    if(!m){
      throw new Error("cannot parse Year and Month");
    }
    const year  = m[1] - 0;
    const month = m[2] - 0;<commit_msg>update nissan-studium parser (#21)<commit_after>import axios from "axios";
import cheerio from "cheerio";
import Event from "./event";
const debug = require("debug")("bot:nissan-stadium");

class NissanStadium{

  constructor(){
    this.url = "http://www.nissan-stadium.jp/calendar/index.php";
  }

  async getEvents(){
    const html = await this.getHtml();
    return this.parseHtml(html);
  }

  async getMajorEvents(){
    const events = await this.getEvents();
    return events.filter((i) => { return /(スタジアム|競技場|フィールド)/.test(i.where) });
  }

  async getHtml(){
    debug(`get ${this.url}`);
    return (await axios.get(this.url)).data;
  }

  parseHtml(html){
    const $ = cheerio.load(html);
    const m = $("h3.mds_red_bg").text().match(/(\d{4})年(\d?\d)月/);
    if(!m){
      throw new Error("cannot parse Year and Month");
    }
    const year  = m[1] - 0;
    const month = m[2] - 0;
{'fraction_non_alphanumeric': 0.18591549295774648, 'fraction_numerical': 0.009014084507042254, 'mean_word_length': 3.321167883211679, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3586703', 'n_tokens_mistral': 674, 'n_tokens_neox': 644, 'n_words': 137}