nkgilley / sbrscrape

Python scripts for scraping odds data from sbrodds (sportsbookreview)
MIT License
13 stars 3 forks source link

Scraping multiple days #2

Open lachgil opened 1 year ago

lachgil commented 1 year ago

I added a little bit of code to allow scraping multiple days, as I'm in Aus time zone it would sometimes be getting the next days data, so this helps to get everything. def scrape_games(self, sport="NBA", date="", current_line=True,allGames=True): _line = 'currentLine' if current_line else 'openingLine' spreads = moneylines = totals = [] if date == "": date = datetime.today().strftime("%Y-%m-%d") yesterday = datetime.now() - timedelta(hours=18) tomorrow = datetime.now() + timedelta(hours=18) if allGames == True: dates = [yesterday.strftime("%Y-%m-%d"),date,tomorrow.strftime("%Y-%m-%d")] else: dates = [date] self.dates = dates for date in dates:

normal code here