From 7a7e4e570eda94fbabd738af3f49671a701f2355 Mon Sep 17 00:00:00 2001 From: Alex Marvin Date: Wed, 28 Aug 2024 22:04:20 -0500 Subject: [PATCH 1/2] Fix current_week() for new Yahoo layout --- ffbot/scraper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ffbot/scraper.py b/ffbot/scraper.py index a58e776..a59558d 100644 --- a/ffbot/scraper.py +++ b/ffbot/scraper.py @@ -1,5 +1,6 @@ from datetime import datetime from io import StringIO +import re import numpy as np import pandas as pd @@ -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 From ff68870668dc16a70ce94a1466294fae5c1f609c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 03:05:26 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ffbot/scraper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffbot/scraper.py b/ffbot/scraper.py index a59558d..374813f 100644 --- a/ffbot/scraper.py +++ b/ffbot/scraper.py @@ -1,6 +1,6 @@ +import re from datetime import datetime from io import StringIO -import re import numpy as np import pandas as pd