Skip to content

Commit

Permalink
Merge pull request #96 from amarvin/91-update-for-2024
Browse files Browse the repository at this point in the history
Fix current_week() for new Yahoo layout
  • Loading branch information
amarvin committed Aug 29, 2024
2 parents d927e74 + 76d475a commit 8622a6c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ffbot/scraper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from datetime import datetime
from io import StringIO

Expand Down Expand Up @@ -188,8 +189,9 @@ def current_week():
s.headers["User-Agent"] = generate_user_agent()
r = s.get(url)
soup = bs(r.text, "lxml")
span = soup.select_one("li.Navitem.current a.Navtarget")
week = span.text.split()[1]
matchups = soup.select_one("#matchupweek .matchups-body")
weeks = re.findall(r"Week (\d+)", matchups.text)
week = weeks[0]
week = int(week)

return week

0 comments on commit 8622a6c

Please sign in to comment.