Skip to content

Commit ea73c83

Browse files
authored
Fix current week (#102)
* Fixes current week * v1.2.9
1 parent 74a51ac commit ea73c83

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ffbot/constants.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "1.2.8"
1+
VERSION = "1.2.9"

ffbot/scraper.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,13 @@ def current_week():
190190

191191
# Parse current week from a public league
192192
s = create_session()
193-
url = "https://football.fantasysports.yahoo.com/f1/{}".format(PUBLIC_LEAGUE)
193+
url = "https://football.fantasysports.yahoo.com/f1/{}/1".format(PUBLIC_LEAGUE)
194194
s.headers["User-Agent"] = generate_user_agent()
195195
r = s.get(url)
196196
soup = bs(r.text, "lxml")
197-
matchups = soup.select_one("#matchupweek .matchups-body")
198-
weeks = re.findall(r"Week (\d+)", matchups.text)
199-
week = weeks[0]
197+
REGEX_PATTERN = r"Week (\d+)"
198+
m = re.search(REGEX_PATTERN, soup.text)
199+
week = m.group(1)
200200
week = int(week)
201201

202202
return week

0 commit comments

Comments
 (0)