Esempio n. 1
0
    def _gen_match_basic_info(self):
        """
        generate and add basic information related to match to match dict
        """
        self.match_['code'] = self.code
        self.match_['type'] = self.type
        self.match_['league'] = self.league
        self.match_['season'] = self.season
        self.match_['country'] = " ".join(
            map(lambda x: x.capitalize(), self.country.split('_')))

        loc_time = [
            el.text for el in self.soup_.find('div', {
                'class': 'scorebox_meta'
            }).find_all('div')
        ]
        if len(loc_time) >= 1:
            date = loc_time[0]
            if 'AM' in date or 'PM' in date:
                date, time = gen_date_with_mins(date)
                self.match_['date'] = str(date)
                self.match_['time'] = str(time)
            else:
                self.match_['date'] = str(gen_date(date))
        if len(loc_time) == 2:
            self.match_['stadium'] = " ".join(
                map(lambda x: x.capitalize(),
                    loc_time[1].split(',')[0].split(' ')))
    def _gen_match_basic_info(self):
        """
        generate and add basic information related to match to match dict
        """
        self.match_['code'] = self.code
        self.match_['type'] = self.type
        self.match_['league'] = self.league
        self.match_['season'] = self.season
        self.match_['country'] = " ".join(map(lambda x: x.capitalize(), self.country.split('_')))

        loc_time = self.soup_.find('td', {'class': 'align_center padding_bottom small_text'}).contents
        if len(loc_time) > 0:
            date = loc_time[0]
            if 'AM' in date or 'PM' in date:
                date, time = gen_date_with_mins(date)
                self.match_['date'] = str(date)
                self.match_['time'] = str(time)
            else:
                self.match_['date'] = str(gen_date(date))
        if len(loc_time) == 3:
            self.match_['stadium'] = " ".join(map(lambda x: x.capitalize(), 
                                loc_time[2].split(',')[0].split(' ')))