From bb1bf9dfd279cfb34a44f5fab4a4dde19684dd07 Mon Sep 17 00:00:00 2001 From: Karl Hudgell Date: Mon, 29 Jan 2024 08:24:38 +0000 Subject: [PATCH] update with new table and results --- base_table.csv | 10 +++++----- fixtures.csv | 6 ++++++ fixtures.ics | 40 ++++++++++++++++++++-------------------- main.py | 4 +++- results.csv | 2 ++ table.csv | 10 +++++----- 6 files changed, 41 insertions(+), 31 deletions(-) diff --git a/base_table.csv b/base_table.csv index cdfc98d..bfb670f 100644 --- a/base_table.csv +++ b/base_table.csv @@ -1,10 +1,10 @@ POS,Team,P,W,D,L,PTS,Unnamed: 7 -1.0,Farnham Town Panthers,6.0,5.0,0.0,1.0,15.0, -2.0,Aldershot B&G Lions,5.0,4.0,0.0,1.0,12.0, -3.0,Down Grange Pumas,3.0,3.0,0.0,0.0,9.0, -4.0,Fernhurst Sports Terriers,4.0,3.0,0.0,1.0,9.0, +1.0,Aldershot B&G Lions,6.0,5.0,0.0,1.0,15.0, +2.0,Farnham Town Panthers,7.0,5.0,0.0,2.0,15.0, +3.0,Fernhurst Sports Terriers,5.0,4.0,0.0,1.0,12.0, +4.0,Down Grange Pumas,3.0,3.0,0.0,0.0,9.0, 5.0,Tongham U12,5.0,2.0,1.0,2.0,7.0, -6.0,Mytchett Athletic Hawks,8.0,2.0,0.0,6.0,6.0, +6.0,Mytchett Athletic Hawks,9.0,2.0,0.0,7.0,6.0, 7.0,Petersfield Town Revolution,6.0,1.0,0.0,5.0,3.0, 8.0,Curley Park Rangers Mambas,5.0,0.0,1.0,4.0,1.0, ,,,,,,, diff --git a/fixtures.csv b/fixtures.csv index f12e422..25bec49 100644 --- a/fixtures.csv +++ b/fixtures.csv @@ -5,3 +5,9 @@ L,10/02/24 08:00,Down Grange U12 Pumas,,VS,,Aldershot B&G U12 Lions,DOWN GRANGE L,17/02/24 08:00,Down Grange U12 Pumas,,VS,,Petersfield Town U12 Revolution,DOWN GRANGE SPORTS COMPLEX #2,U12 Division 8 - No Heading Trial,Match Notes: Double Header - Matches to be played at Down Grange's ground L,17/02/24 08:00,Petersfield Town U12 Revolution,,VS,,Down Grange U12 Pumas,DOWN GRANGE SPORTS COMPLEX #2,U12 Division 8 - No Heading Trial,Match Notes: Double Header - Matches to be played at Down Grange's ground L,TBC,Curley Park Rangers U12 Mambas,,VS,,Down Grange U12 Pumas,LIGHTWATER RECREATION GROUND,U12 Division 8 - No Heading Trial,Postponed +Cup,24/02/24 08:00,Bourne Blades U12 Whites,,VS,,Down Grange U12 Pumas,WAVERLEY ABBEY JUNIOR SCHOOL #2,U12 League Shield (No Deliberate Heading)_2023 - 2024, +L,02/03/24 08:00,Tongham U12,,VS,,Down Grange U12 Pumas,POYLE ROAD RECREATION GROUND #2,U12 Division 8 - No Heading Trial, +L,09/03/24 08:00,Down Grange U12 Pumas,,VS,,Farnham Town U12 Panthers,DOWN GRANGE SPORTS COMPLEX #2,U12 Division 8 - No Heading Trial, +L,16/03/24 08:00,Down Grange U12 Pumas,,VS,,Fernhurst Sports U12 Terriers,DOWN GRANGE SPORTS COMPLEX #2,U12 Division 8 - No Heading Trial, +L,06/04/24 08:00,Down Grange U12 Pumas,,VS,,Tongham U12,DOWN GRANGE SPORTS COMPLEX #2,U12 Division 8 - No Heading Trial, +L,23/04/24 08:00,Down Grange U12 Pumas,,VS,,Curley Park Rangers U12 Mambas,DOWN GRANGE SPORTS COMPLEX #2,U12 Division 8 - No Heading Trial, diff --git a/fixtures.ics b/fixtures.ics index 151355b..75608f0 100644 --- a/fixtures.ics +++ b/fixtures.ics @@ -2,12 +2,12 @@ BEGIN:VCALENDAR VERSION:2.0 PRODID:Down Grange Pumas Fixtures BEGIN:VEVENT -SUMMARY:(League) Fernhurst Sports Terriers (4th) VS Down Grange Pumas (3rd +SUMMARY:(League) Fernhurst Sports Terriers (3rd) VS Down Grange Pumas (4th ) DTSTART:20240203T093000 DTEND:20240203T113000 DTSTAMP:20240203T093000Z -UID:940f237d-d1f1-4e89-bf82-f99d01e2f634 +UID:84b74493-5265-450a-b050-51b39b875bf6 DESCRIPTION:Arrive by - 2024-02-03 09:00:00\nNo Match Notes\nTable -\nhttp s://fulltime.thefa.com/table.html?selectedSeason=19010414&selectedDivision =165601607&ftsTablePageContent.fixtureAnalysisForm.standingsTableDay=14&ft @@ -16,11 +16,11 @@ DESCRIPTION:Arrive by - 2024-02-03 09:00:00\nNo Match Notes\nTable -\nhttp LOCATION:FERNHURST RECREATION GROUND END:VEVENT BEGIN:VEVENT -SUMMARY:(League) Down Grange Pumas (3rd) VS Aldershot B&G Lions (2nd) +SUMMARY:(League) Down Grange Pumas (4th) VS Aldershot B&G Lions (1st) DTSTART:20240210T093000 DTEND:20240210T113000 DTSTAMP:20240210T093000Z -UID:1e1a55f1-f96c-4315-b959-20c4fc615332 +UID:722c259d-5db7-4930-bf76-015db00ce09d DESCRIPTION:Arrive by - 2024-02-10 09:00:00\nNo Match Notes\nTable -\nhttp s://fulltime.thefa.com/table.html?selectedSeason=19010414&selectedDivision =165601607&ftsTablePageContent.fixtureAnalysisForm.standingsTableDay=14&ft @@ -29,12 +29,12 @@ DESCRIPTION:Arrive by - 2024-02-10 09:00:00\nNo Match Notes\nTable -\nhttp LOCATION:DOWN GRANGE SPORTS COMPLEX #2 END:VEVENT BEGIN:VEVENT -SUMMARY:(League) Down Grange Pumas (3rd) VS Petersfield Town Revolution (7 +SUMMARY:(League) Down Grange Pumas (4th) VS Petersfield Town Revolution (7 th) DTSTART:20240217T093000 DTEND:20240217T113000 DTSTAMP:20240217T093000Z -UID:1f00d29c-5164-45b3-b356-3a07a82356b0 +UID:839714c6-e130-4948-8657-7c10a96ed4c9 DESCRIPTION:Arrive by - 2024-02-17 09:00:00\nMatch Notes: Double Header - Matches to be played at Down Grange's ground\nTable -\nhttps://fulltime.t hefa.com/table.html?selectedSeason=19010414&selectedDivision=165601607&fts @@ -44,12 +44,12 @@ DESCRIPTION:Arrive by - 2024-02-17 09:00:00\nMatch Notes: Double Header - LOCATION:DOWN GRANGE SPORTS COMPLEX #2 END:VEVENT BEGIN:VEVENT -SUMMARY:(League) Petersfield Town Revolution (7th) VS Down Grange Pumas (3 - rd) +SUMMARY:(League) Petersfield Town Revolution (7th) VS Down Grange Pumas (4 + th) DTSTART:20240217T093000 DTEND:20240217T113000 DTSTAMP:20240217T093000Z -UID:06aa7538-f9e5-488a-bc3e-9f56974c6ae2 +UID:daaad7c9-2e24-4207-8f51-e0d663e9d17d DESCRIPTION:Arrive by - 2024-02-17 09:00:00\nMatch Notes: Double Header - Matches to be played at Down Grange's ground\nTable -\nhttps://fulltime.t hefa.com/table.html?selectedSeason=19010414&selectedDivision=165601607&fts @@ -63,7 +63,7 @@ SUMMARY:(Cup) Bourne Blades Whites VS Down Grange Pumas DTSTART:20240224T093000 DTEND:20240224T113000 DTSTAMP:20240224T093000Z -UID:9ed6ee8b-a37f-445a-bdf6-d956b3183c4c +UID:b28fbfdb-3a65-426d-913d-b1d86b9be841 DESCRIPTION:Arrive by - 2024-02-24 09:00:00\nNo Match Notes\nTable -\nhttp s://fulltime.thefa.com/table.html?selectedSeason=19010414&selectedDivision =165601607&ftsTablePageContent.fixtureAnalysisForm.standingsTableDay=14&ft @@ -72,11 +72,11 @@ DESCRIPTION:Arrive by - 2024-02-24 09:00:00\nNo Match Notes\nTable -\nhttp LOCATION:WAVERLEY ABBEY JUNIOR SCHOOL #2 END:VEVENT BEGIN:VEVENT -SUMMARY:(League) Tongham U12 (5th) VS Down Grange Pumas (3rd) +SUMMARY:(League) Tongham U12 (5th) VS Down Grange Pumas (4th) DTSTART:20240302T093000 DTEND:20240302T113000 DTSTAMP:20240302T093000Z -UID:0ec99c97-e48d-457b-a650-a5e55031ff06 +UID:78521845-1639-4701-8b14-a06b01e14ee9 DESCRIPTION:Arrive by - 2024-03-02 09:00:00\nNo Match Notes\nTable -\nhttp s://fulltime.thefa.com/table.html?selectedSeason=19010414&selectedDivision =165601607&ftsTablePageContent.fixtureAnalysisForm.standingsTableDay=14&ft @@ -85,11 +85,11 @@ DESCRIPTION:Arrive by - 2024-03-02 09:00:00\nNo Match Notes\nTable -\nhttp LOCATION:POYLE ROAD RECREATION GROUND #2 END:VEVENT BEGIN:VEVENT -SUMMARY:(League) Down Grange Pumas (3rd) VS Farnham Town Panthers (1st) +SUMMARY:(League) Down Grange Pumas (4th) VS Farnham Town Panthers (2nd) DTSTART:20240309T093000 DTEND:20240309T113000 DTSTAMP:20240309T093000Z -UID:cc926d4d-2cfd-4dc6-8f03-178c9fd367e5 +UID:0f8d560f-89ab-4dad-b8ff-a144e1b36387 DESCRIPTION:Arrive by - 2024-03-09 09:00:00\nNo Match Notes\nTable -\nhttp s://fulltime.thefa.com/table.html?selectedSeason=19010414&selectedDivision =165601607&ftsTablePageContent.fixtureAnalysisForm.standingsTableDay=14&ft @@ -98,12 +98,12 @@ DESCRIPTION:Arrive by - 2024-03-09 09:00:00\nNo Match Notes\nTable -\nhttp LOCATION:DOWN GRANGE SPORTS COMPLEX #2 END:VEVENT BEGIN:VEVENT -SUMMARY:(League) Down Grange Pumas (3rd) VS Fernhurst Sports Terriers (4th +SUMMARY:(League) Down Grange Pumas (4th) VS Fernhurst Sports Terriers (3rd ) DTSTART:20240316T093000 DTEND:20240316T113000 DTSTAMP:20240316T093000Z -UID:20a4940e-d0d8-47c1-a563-ff92cbd3c061 +UID:7a175bf2-d6da-4eb9-8bf0-9abd5fa4b74c DESCRIPTION:Arrive by - 2024-03-16 09:00:00\nNo Match Notes\nTable -\nhttp s://fulltime.thefa.com/table.html?selectedSeason=19010414&selectedDivision =165601607&ftsTablePageContent.fixtureAnalysisForm.standingsTableDay=14&ft @@ -112,11 +112,11 @@ DESCRIPTION:Arrive by - 2024-03-16 09:00:00\nNo Match Notes\nTable -\nhttp LOCATION:DOWN GRANGE SPORTS COMPLEX #2 END:VEVENT BEGIN:VEVENT -SUMMARY:(League) Down Grange Pumas (3rd) VS Tongham U12 (5th) +SUMMARY:(League) Down Grange Pumas (4th) VS Tongham U12 (5th) DTSTART:20240406T093000 DTEND:20240406T113000 DTSTAMP:20240406T093000Z -UID:39433d36-92a1-453d-b615-3465961b1f0e +UID:45b06c35-e4fb-4274-9002-d7159e46f269 DESCRIPTION:Arrive by - 2024-04-06 09:00:00\nNo Match Notes\nTable -\nhttp s://fulltime.thefa.com/table.html?selectedSeason=19010414&selectedDivision =165601607&ftsTablePageContent.fixtureAnalysisForm.standingsTableDay=14&ft @@ -125,12 +125,12 @@ DESCRIPTION:Arrive by - 2024-04-06 09:00:00\nNo Match Notes\nTable -\nhttp LOCATION:DOWN GRANGE SPORTS COMPLEX #2 END:VEVENT BEGIN:VEVENT -SUMMARY:(League) Down Grange Pumas (3rd) VS Curley Park Rangers Mambas (8t +SUMMARY:(League) Down Grange Pumas (4th) VS Curley Park Rangers Mambas (8t h) DTSTART:20240423T093000 DTEND:20240423T113000 DTSTAMP:20240423T093000Z -UID:60ec033e-fbf9-4dc1-97b9-5f1a4649c8af +UID:6f0aacd6-cb55-47b4-a62d-85f8c72e36b6 DESCRIPTION:Arrive by - 2024-04-23 09:00:00\nNo Match Notes\nTable -\nhttp s://fulltime.thefa.com/table.html?selectedSeason=19010414&selectedDivision =165601607&ftsTablePageContent.fixtureAnalysisForm.standingsTableDay=14&ft diff --git a/main.py b/main.py index 5c07ab7..240bbdf 100644 --- a/main.py +++ b/main.py @@ -133,7 +133,7 @@ def process_table(table_df:pd.DataFrame)->pd.DataFrame: return table_df def process_results()->None: - req = requests.get("https://fulltime.thefa.com/results.html?selectedSeason=19010414&selectedFixtureGroupAgeGroup=11&selectedFixtureGroupKey=1_579285719&selectedRelatedFixtureOption=1&selectedClub=&selectedTeam=466317969&selectedDateCode=all&previousSelectedFixtureGroupAgeGroup=11&previousSelectedFixtureGroupKey=1_579285719&previousSelectedClub=") + req = requests.get("https://fulltime.thefa.com/results.html?selectedSeason=19010414&selectedFixtureGroupAgeGroup=11&selectedFixtureGroupKey=1_579285719&selectedRelatedFixtureOption=3&selectedClub=&selectedTeam=466317969&selectedDateCode=all&previousSelectedFixtureGroupAgeGroup=11&previousSelectedFixtureGroupKey=1_579285719&previousSelectedClub=") doc = lh.fromstring(req.text) headers = ['Date', 'Home Team', 'Score', 'Away Team'] @@ -145,6 +145,8 @@ def process_results()->None: date = row.xpath(f'/html[1]/body[1]/main[1]/div[2]/section[1]/div[1]/div[3]/div[1]/div[2]/div[{idx}]/div[1]/div[3]/a[1]/span[1]//text()')[0] home_team = row.xpath(f'/html[1]/body[1]/main[1]/div[2]/section[1]/div[1]/div[3]/div[1]/div[2]/div[{idx}]/div[1]/div[4]/div[1]/a[1]//text()')[0].strip() score = row.xpath(f'/html[1]/body[1]/main[1]/div[2]/section[1]/div[1]/div[3]/div[1]/div[2]/div[{idx}]/div[1]/div[5]//text()')[0].strip() + if score == 'X - X': + continue away_team = row.xpath(f'/html[1]/body[1]/main[1]/div[2]/section[1]/div[1]/div[3]/div[1]/div[2]/div[{idx}]/div[1]/div[6]/div[2]/a[1]//text()')[0].strip() file.writerow([date,home_team,score,away_team]) diff --git a/results.csv b/results.csv index 7120e74..37fce92 100644 --- a/results.csv +++ b/results.csv @@ -1,4 +1,6 @@ Date,Home Team,Score,Away Team +27/01/24,Beacon Hill U12 Rockets,1 - 9,Down Grange U12 Pumas 13/01/24,Farnham Town U12 Panthers,2 - 3,Down Grange U12 Pumas 16/12/23,Mytchett Athletic U12 Hawks,2 - 4,Down Grange U12 Pumas 25/11/23,Aldershot B&G U12 Lions,2 - 4,Down Grange U12 Pumas +11/11/23,Down Grange Youth U12 Pumas,0 - 12,Horndean Hawks Youth Horndean Hawks U12 diff --git a/table.csv b/table.csv index 232473e..0ebdcdc 100644 --- a/table.csv +++ b/table.csv @@ -1,9 +1,9 @@ POS,Team,P,W,D,L,PTS -1,Farnham Town Panthers,6,5,0,1,15 -2,Aldershot B&G Lions,5,4,0,1,12 -3,Down Grange Pumas,3,3,0,0,9 -4,Fernhurst Sports Terriers,4,3,0,1,9 +1,Aldershot B&G Lions,6,5,0,1,15 +2,Farnham Town Panthers,7,5,0,2,15 +3,Fernhurst Sports Terriers,5,4,0,1,12 +4,Down Grange Pumas,3,3,0,0,9 5,Tongham U12,5,2,1,2,7 -6,Mytchett Athletic Hawks,8,2,0,6,6 +6,Mytchett Athletic Hawks,9,2,0,7,6 7,Petersfield Town Revolution,6,1,0,5,3 8,Curley Park Rangers Mambas,5,0,1,4,1