diff --git a/README.md b/README.md index 76d1262..4ae8a82 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ pip install volleystats - Home Points - Guest Points - Date - - Location + - Stadium - Match - Match ID @@ -57,7 +57,7 @@ pip install volleystats - Home Team - Guest Team - Coach - - Location + - Stadium - Total Points - Break Points - Win-Lost @@ -104,7 +104,7 @@ volleystats --fed FED --match MATCH - Command: $ `volleystats --fed cbv --match 1623` - Output files: ``` - data/cbv-1623-22-10-28-guest-barueri-volleyball-club.csv + data/cbv-1623-22-10-28-guest-baruerivolleyballclub.csv data/cbv-1623-22-10-28-home-fluminense.csv ``` @@ -115,7 +115,7 @@ volleystats --fed FED --match MATCH - Command: $ `volleystats --fed lvf --match 2093` - Output files: ``` - data/lvf-2093-2022-11-23-guest-jonavos-sc.csv + data/lvf-2093-2022-11-23-guest-jonavossc.csv data/lvf-2093-2022-11-23-home-svaja-viktorija-lsu.csv ``` @@ -185,12 +185,12 @@ volleystats --fed FED --batch CSV_FILE_PATH - Command: $ `volleystats --fed cbv --batch data/cbv-18-2022-2023-competition-matches.csv` - Output files: ``` - data/cbv-1623-22-10-28-guest-barueri-volleyball-club.csv + data/cbv-1623-22-10-28-guest-baruerivolleyballclub.csv data/cbv-1623-22-10-28-home-fluminense.csv - data/cbv-1618-2022-11-01-guest-energis-8-s-o-caetano.csv - data/cbv-1618-2022-11-01-home-esporte-clube-pinheiros.csv - data/cbv-1619-2022-11-01-guest-abel-moda-volei.csv - data/cbv-1619-2022-11-01-home-gerdau-minas.csv + data/cbv-1618-2022-11-01-guest-energis8sãocaetano.csv + data/cbv-1618-2022-11-01-home-esporteclubepinheiros.csv + data/cbv-1619-2022-11-01-guest-abelmodavolei.csv + data/cbv-1619-2022-11-01-home-gerdauminas.csv ... ``` @@ -221,7 +221,7 @@ ____________________|____-_ _|_______________, volleystats: started volleystats: data/cbv-1623-22-10-28-home-fluminense.csv file was created -volleystats: data/cbv-1623-22-10-28-guest-barueri-volleyball-club.csv file was created +volleystats: data/cbv-1623-22-10-28-guest-baruerivolleyballclub.csv file was created volleystats: finished ``` diff --git a/volleystats/settings.py b/volleystats/settings.py index 374ce2f..8f0a962 100644 --- a/volleystats/settings.py +++ b/volleystats/settings.py @@ -34,7 +34,7 @@ #COOKIES_ENABLED = False # Disable Telnet Console (enabled by default) -#TELNETCONSOLE_ENABLED = False +TELNETCONSOLE_ENABLED = False # Override the default request headers: #DEFAULT_REQUEST_HEADERS = { diff --git a/volleystats/spiders/competition.py b/volleystats/spiders/competition.py index a1279da..0bfb5f6 100644 --- a/volleystats/spiders/competition.py +++ b/volleystats/spiders/competition.py @@ -59,7 +59,7 @@ def parse(self, response): competition = { 'Match ID': match_id, 'Match Date': match_date, - 'Location': match_location, + 'Stadium': match_location, 'Home Team': home_team, 'Home Points': home_points, 'Guest Team': guest_team, diff --git a/volleystats/spiders/match.py b/volleystats/spiders/match.py index f434e63..03fe719 100644 --- a/volleystats/spiders/match.py +++ b/volleystats/spiders/match.py @@ -13,6 +13,7 @@ def __init__(self, fed_acronym='', match_id='', **kwargs): self.match_id = match_id match_date = '' home_team = '' + home_team_file = '' super().__init__(**kwargs) @@ -27,10 +28,10 @@ def parse(self, response): if enGB == 'EN': match_date = parse_engb_date(match_date_text) - home_team_string = response.xpath("normalize-space(//span[@id='Content_Main_LBL_HomeTeam']/text())").get().replace(' ', '-') - home_team = re.sub('[^A-Za-z0-9]+', '-', home_team_string) - if home_team: - home_team = home_team.lower() + home_team_string = response.xpath("normalize-space(//span[@id='Content_Main_LBL_HomeTeam']/text())").get() + if home_team_string: + home_team = home_team_string.lower() + home_team_file = re.sub(' ', '', home_team) coach = response.xpath("//span[@id='Content_Main_ctl17_RP_MatchStats_Coach_Home_0']/text()").get() if coach: @@ -98,10 +99,11 @@ def parse(self, response): self.match_date = match_date self.home_team = home_team + self.home_team_file = home_team_file def closed(spider, reason): src = f'data/{spider.fed_acronym}-{spider.match_id}-home_stats.csv' - dst = f'data/{spider.fed_acronym}-{spider.match_id}-{spider.match_date}-home-{spider.home_team}.csv' + dst = f'data/{spider.fed_acronym}-{spider.match_id}-{spider.match_date}-home-{spider.home_team_file}.csv' try: os.rename(src, dst) @@ -119,6 +121,7 @@ def __init__(self, fed_acronym='', match_id='', **kwargs): self.match_id = match_id match_date = '' guest_team = '' + guest_team_file = '' super().__init__(**kwargs) @@ -133,10 +136,10 @@ def parse(self, response): if enGB == 'EN': match_date = parse_engb_date(match_date_text) - guest_team_string = response.xpath("normalize-space(//span[@id='Content_Main_LBL_GuestTeam']/text())").get().replace(' ', '-') - guest_team = re.sub('[^A-Za-z0-9]+', '-', guest_team_string) - if guest_team: - guest_team = guest_team.lower() + guest_team_string = response.xpath("normalize-space(//span[@id='Content_Main_LBL_GuestTeam']/text())").get() + if guest_team_string: + guest_team = guest_team_string.lower() + guest_team_file = re.sub(' ', '', guest_team) coach = response.xpath("//span[@id='Content_Main_ctl17_RP_MatchStats_Coach_Guest_0']/text()").get() if coach: @@ -204,10 +207,11 @@ def parse(self, response): self.match_date = match_date self.guest_team = guest_team + self.guest_team_file = guest_team_file def closed(spider, reason): src = f'data/{spider.fed_acronym}-{spider.match_id}-guest_stats.csv' - dst = f'data/{spider.fed_acronym}-{spider.match_id}-{spider.match_date}-guest-{spider.guest_team}.csv' + dst = f'data/{spider.fed_acronym}-{spider.match_id}-{spider.match_date}-guest-{spider.guest_team_file}.csv' try: os.rename(src, dst) diff --git a/volleystats/version.py b/volleystats/version.py index 2b33f3a..85f0bcd 100644 --- a/volleystats/version.py +++ b/volleystats/version.py @@ -1 +1 @@ -__version__ = '0.8' \ No newline at end of file +__version__ = '0.8.1' \ No newline at end of file