oseymour / ScraperFC

Python package for scraping soccer data from a variety of sources
GNU General Public License v3.0
222 stars 49 forks source link

Problem Occuring When There is No Shot from one of team #9

Closed hedonistrh closed 1 year ago

hedonistrh commented 1 year ago

Hey, in this match https://fbref.com/en/matches/dfe3f4a0/DC-United-New-York-City-FC-September-6-2020-Major-League-Soccer there is no shot from the home team. 😓 Because of that there can be exception in here. To solve that, probably, need to check first column's name and then set those stats. 🤔

I am adding an example if anyone would like to re-produce the issue.

import ScraperFC as sfc
scraper_fbref = sfc.FBRef()
single_match_url = "https://fbref.com/en/matches/dfe3f4a0/DC-United-New-York-City-FC-September-6-2020-Major-League-Soccer"
year = 2020
league_name = "MLS"
fbref_match_data = scraper_fbref.scrape_match(link=single_match_url, year=year, league=league_name)
oseymour commented 1 year ago

@hedonistrh This should be fixed in the latest version, 2.1.4. Let me know if you're still having problems.

hedonistrh commented 1 year ago

Hey @oseymour, thanks a lot for taking care of that bug. Looks like scrape_match() just need url instead of additional year and league name. When I make that change and run the following, that is working without any issue. So I am closing that. Thanks again. 🙏🏼

import ScraperFC as sfc
scraper_fbref = sfc.FBRef()
single_match_url = "https://fbref.com/en/matches/dfe3f4a0/DC-United-New-York-City-FC-September-6-2020-Major-League-Soccer"
year = 2020
league_name = "MLS"
fbref_match_data = scraper_fbref.scrape_match(link=single_match_url)