ufcscraper.ufc_scraper module

class ufcscraper.ufc_scraper.UFCScraper(data_folder: Path | str, n_sessions: int | None = 1, delay: float | None = 0)[source]

Bases: BaseScraper

A class to handle scraping of UFC-related data.

This class is responsible for initializing and managing the individual scrapers for UFC events, fighters, and fights. It provides methods to check data files, load data, remove duplicates, and scrape different types of UFC data.

data_folder

Path to the folder where data will be stored.

n_sessions

Number of concurrent sessions to use for scraping.

delay

Delay between requests in seconds.

event_scraper

Scraper instance for UFC events.

fighter_scraper

Scraper instance for UFC fighters.

fight_scraper

Scraper instance for UFC fights.

replacement_scraper

Scraper instance for replacement fights.

check_data_file() None[source]

Check the integrity of data files for all scrapers.

This method iterates over all scrapers and verifies their data files.

load_data() None[source]

Load data for all scrapers.

This method iterates over all scrapers and loads their data.

remove_duplicates_from_file() None[source]

Remove duplicate entries from data files for all scrapers.

This method iterates over all scrapers and removes duplicates from their data files.

scrape_events() None[source]

Scrape event data.

Calls the event scraper to collect event information.

scrape_fighters() None[source]

Scrape fighter data.

Calls the fighter scraper to collect fighter information.

scrape_fights(get_all_events: bool = False) None[source]

Scrape fight data.

Calls the fight scraper to collect fight information based on the

specified parameter.

Parameters:

get_all_events – If False, only scrapes fights from events not already scraped.

scrape_replacements() None[source]

Scrape replacement data.

Calls the replacement scraper to collect replacement information.