Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix current week #102

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ffbot/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "1.2.8"
VERSION = "1.2.9"
8 changes: 4 additions & 4 deletions ffbot/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@

# Parse current week from a public league
s = create_session()
url = "https://football.fantasysports.yahoo.com/f1/{}".format(PUBLIC_LEAGUE)
url = "https://football.fantasysports.yahoo.com/f1/{}/1".format(PUBLIC_LEAGUE)

Check warning on line 193 in ffbot/scraper.py

View check run for this annotation

Codecov / codecov/patch

ffbot/scraper.py#L193

Added line #L193 was not covered by tests
s.headers["User-Agent"] = generate_user_agent()
r = s.get(url)
soup = bs(r.text, "lxml")
matchups = soup.select_one("#matchupweek .matchups-body")
weeks = re.findall(r"Week (\d+)", matchups.text)
week = weeks[0]
REGEX_PATTERN = r"Week (\d+)"
m = re.search(REGEX_PATTERN, soup.text)
week = m.group(1)

Check warning on line 199 in ffbot/scraper.py

View check run for this annotation

Codecov / codecov/patch

ffbot/scraper.py#L197-L199

Added lines #L197 - L199 were not covered by tests
week = int(week)

return week
Loading