Capology

class ScraperFC.capology.Capology

Bases: object

get_league_url(league: str) str

Returns the URL for the requested league

Parameters:

league (str) – See the src/ScraperFC/comps.yaml file for all available competitions and which modules can be used to scrape them.

Raises:
  • TypeError – If the league is not a string.

  • InvalidLeagueException – If the league is not valid for this module.

Returns:

League URL

Return type:

str

get_season_url(year: str, league: str) str

Gets URL to chosen year of league

Parameters:
  • year (str) – See the Capology year parameter docs for details.

  • league (str) – See the src/ScraperFC/comps.yaml file for all available competitions and which modules can be used to scrape them.

Raises:
  • TypeError – If any of the parameters are the wrong type.

  • InvalidYearException – If the year is not valid for the league.

Returns:

Season URL

Return type:

str

get_valid_seasons(league: str) list[str]

Returns valid season strings for the chosen league

Parameters:

league (str) – See the src/ScraperFC/comps.yaml file for all available competitions and which modules can be used to scrape them.

Raises:
  • TypeError – If any of the parameters are the wrong type.

  • InvalidLeagueException – If the league is not valid for this module.

Returns:

List of valid year strings for this league

Return type:

list[str]

scrape_payrolls(year: str, league: str, currency: str) DataFrame

Deprecated. Use scrape_salaries() instead.

scrape_salaries(year: str, league: str, currency: str) DataFrame

Scrapes player salaries for the given league season.

Parameters:
  • year (str) – See the Capology year parameter docs for details.

  • league (str) – See the src/ScraperFC/comps.yaml file for all available competitions and which modules can be used to scrape them.

  • currency (str) – The currency for the returned salaries. Options are “eur” for Euro, “gbp” for British Pound, and “USD” for US Dollar

Raises:
  • TypeError – If any of the parameters are the wrong type.

  • InvalidCurrencyException – If currency is not a valid choice.

Returns:

The salaries of all players in the given league season

Return type:

pd.DataFrame