def scrape_all_tournaments_for_game(game): """Scrape all match data and write to a set of files.""" date_file, url_folder, result_folder = get_game_folders(game) tournaments = get_tournaments(date_file, url_folder) for tournament in tournaments: print(tournament) tournament_filename = get_filename(result_folder, tournament) safe_delete(tournament_filename) scrapers.scrape_tournament(tournament_filename, tournaments[tournament])
def scrape_tournament_by_game(game, tournament): date_file, url_folder, result_folder = get_game_folders(game) try: urls = get_tournament_urls(tournament, url_folder) tournament_filename = get_filename(result_folder, tournament) safe_delete(tournament_filename) scrapers.scrape_tournament(tournament_filename, urls) except FileNotFoundError: print("No " + game + " data found for tournament '" + tournament + "'.")