<commit_before>from core.parsers.matchday_parser import MatchdayParser
from core.web.ofm_page_constants import Constants
from core.web.site_manager import SiteManager
from django_cron import CronJobBase, Schedule


class ParseMatchdayCronJob(CronJobBase):
    RUN_AT_TIMES = ['03:00']

    schedule = Schedule(run_at_times=RUN_AT_TIMES)
    code = 'core.cron.parse_matchday'

    def do(self):
        site_manager = SiteManager()
        site_manager.login()
        site_manager.jump_to_frame(Constants.HEAD)

        matchday_parser = MatchdayParser(site_manager.browser.page_source)
        current_matchday = matchday_parser.parse()

        site_manager.kill()

        print("parsed Matchday is: %s" % current_matchday)<commit_msg>use the first ofm users credentials<commit_after>from core.parsers.matchday_parser import MatchdayParser
from core.web.ofm_page_constants import Constants
from core.web.site_manager import SiteManager
from django_cron import CronJobBase, Schedule
from users.models import OFMUser


class ParseMatchdayCronJob(CronJobBase):
    RUN_AT_TIMES = ['03:00']

    schedule = Schedule(run_at_times=RUN_AT_TIMES)
    code = 'core.cron.parse_matchday'

    def do(self):
        ofm_users = OFMUser.objects.exclude(ofm_username__isnull=True)

        site_manager = SiteManager(ofm_users[0] if ofm_users else None)
        site_manager.login()
        site_manager.jump_to_frame(Constants.HEAD)

        matchday_parser = MatchdayParser(site_manager.browser.page_source)
        current_matchday = matchday_parser.parse()

        site_manager.kill()

        print("parsed Matchday is: %s" % current_matchday)
{'fraction_non_alphanumeric': 0.07875457875457875, 'fraction_numerical': 0.005494505494505495, 'mean_word_length': 4.270096463022508, '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': '2944737', 'n_tokens_mistral': 530, 'n_tokens_neox': 508, 'n_words': 96}