<commit_before>"""List upcoming CTFs"""

# PYTHON STUFFS #######################################################

from bs4 import BeautifulSoup

from nemubot.hooks import hook
from nemubot.tools.web import getURLContent, striphtml
from nemubot.module.more import Response


# GLOBALS #############################################################

URL = 'https://ctftime.org/event/list/upcoming'


# MODULE INTERFACE ####################################################

@hook.command("ctfs",
      help="Display the upcoming CTFs")
def get_info_yt(msg):
    soup = BeautifulSoup(getURLContent(URL))

    res = Response(channel=msg.channel, nomore="No more upcoming CTF")

    for line in soup.body.find_all('tr'):
        n = line.find_all('td')
        if len(n) == 5:
            try:
                res.append_message("\x02%s:\x0F from %s type %s at %s. %s" %
                                   tuple([striphtml(x.text) for x in n]))
            except:
                pass
    return res<commit_msg>ctfs: update module reflecting site changes<commit_after>"""List upcoming CTFs"""

# PYTHON STUFFS #######################################################

from bs4 import BeautifulSoup

from nemubot.hooks import hook
from nemubot.tools.web import getURLContent, striphtml
from nemubot.module.more import Response


# GLOBALS #############################################################

URL = 'https://ctftime.org/event/list/upcoming'


# MODULE INTERFACE ####################################################

@hook.command("ctfs",
      help="Display the upcoming CTFs")
def get_info_yt(msg):
    soup = BeautifulSoup(getURLContent(URL))

    res = Response(channel=msg.channel, nomore="No more upcoming CTF")

    for line in soup.body.find_all('tr'):
        n = line.find_all('td')
        if len(n) == 7:
            res.append_message("\x02%s:\x0F from %s type %s at %s. Weight: %s. %s%s" %
                               tuple([striphtml(x.text).strip() for x in n]))

    return res
{'fraction_non_alphanumeric': 0.2684026039058588, 'fraction_numerical': 0.005007511266900351, 'mean_word_length': 3.520361990950226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4353122', 'n_tokens_mistral': 597, 'n_tokens_neox': 567, 'n_words': 141}