-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hoon
committed
Mar 18, 2024
1 parent
538dd99
commit d677244
Showing
3 changed files
with
39 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from basketball_reference_web_scraper import client | ||
from basketball_reference_web_scraper.data import OutputType | ||
from datetime import date | ||
import json | ||
|
||
class BasketballStats: | ||
def __init__(self, client, output_format, current_date): | ||
self.client = client | ||
self.output_format = output_format | ||
self.current_date = current_date | ||
|
||
def daily_player_stats(self): | ||
daily_stats_raw = self.client.player_box_scores( | ||
day=self.current_date.day, | ||
month=self.current_date.month, | ||
year=self.current_date.year, | ||
output_type=self.output_format | ||
) | ||
|
||
return json.loads(daily_stats_raw) | ||
|
||
if __name__ == "__main__": | ||
stats_scraper = BasketballStats(client, OutputType.JSON, date.today()) | ||
daily_stats = stats_scraper.scrape_daily_player_stats() | ||
print(daily_stats) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters