<commit_before>from bs4 import BeautifulSoup
from datetime import datetime, date
from collections import OrderedDict
from ..scraper import Scraper
import requests
import pytz
import json

class UTEvents:
    """A scraper for Events at the University of Toronto."""

    host = 'https://www.events.utoronto.ca/'

    campuses = [
    	{"id" : 1, "name" : "<NAME>", "tag" : "utsg"},
     	{"id" : 2, "name" : "U of T Mississauga", "tag" : "utm"},
     	{"id" : 3, "name" : "U of T Scarborough", "tag" : "utsc"}, 
     	{"id" : 0, "name" : "Off Campus", "tag" : "off"},
     	]

    s = requests.Session()

    @staticmethod
    def scrape(location='.'):
        Scraper.logger.info('UTEvents initialized.')
        Scraper.logger.info('Not implemented.')
        raise NotImplementedError('This scraper has not been implemented yet.')
        Scraper.logger.info('UTEvents completed.')<commit_msg>First layer, get the links to all the events<commit_after>from bs4 import BeautifulSoup
from datetime import datetime, date
from collections import OrderedDict
from ..scraper import Scraper
import requests
import pytz
import json


import urllib.parse as urlparse
from urllib.parse import urlencode

class UTEvents:
    """A scraper for Events at the University of Toronto."""

    host = 'https://www.events.utoronto.ca/'

    campuses = [
    	{"id" : 1, "name" : "<NAME>", "tag" : "utsg"},
     	{"id" : 2, "name" : "U of T Mississauga", "tag" : "utm"},
     	{"id" : 3, "name" : "U of T Scarborough", "tag" : "utsc"}, 
     	{"id" : 0, "name" : "Off Campus", "tag" : "off"},
     	]

    s = requests.Session()

    @staticmethod
    def scrape(location='.'):

        Scraper.logger.info('UTEvents initialized.')
        return UTEvents.get_events_links()
        Scraper.logger.info('UTEvents completed.')

    @staticmethod
    def get_events_links():
        page_index_url = UTEvents.host + "index.php"
        url_parts = list(urlparse.urlparse(page_index_url))
        events_links = []
        paging_index = 1
        events_count = 10 
        while(events_count == 10):
            params = {
                    'p': paging_index
                }
            url_parts[4] = urlencode(params)
            paging_index += 1
            html = UTEvents.s.get(urlparse.urlunparse(url_parts)).text
            soup = BeautifulSoup(html, 'html.parser')
            events_dom_arr = soup.select('#results')[0].find_all('li')
            events_count = len(events_dom_arr)
            events_links += list(map(lambda e: e.a['href'], events_dom_arr))
        return(events_links)                


{'fraction_non_alphanumeric': 0.13807692307692307, 'fraction_numerical': 0.006923076923076923, 'mean_word_length': 2.637762237762238, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '5924167', 'n_tokens_mistral': 863, 'n_tokens_neox': 820, 'n_words': 218}