[GH-ISSUE #544] [FBref] Error getting player1 in some events #98

Closed
opened 2026-03-02 15:55:46 +03:00 by kerem · 3 comments
Owner

Originally created by @nachouve on GitHub (Apr 16, 2024).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/544

Issue Summary:

I encountered an issue with soccerdata while parsing HTML for certain events in FBref.

Details:
The error occurs in this line of the code where the player1 variable is set. Sometimes, there is no tag present here, but it has the name of person who was issued with a yellow card, for example.

Steps to Reproduce:

import soccerdata as sd
fbref = sd.FBref(seasons=['2324'], leagues=["ESP-La Liga"])
fbref.read_events(match_id="e8867e6b")

Expected Behavior:
The read_events() function should handle cases where the tag is missing gracefully, rather than causing an error.

Originally created by @nachouve on GitHub (Apr 16, 2024). Original GitHub issue: https://github.com/probberechts/soccerdata/issues/544 **Issue Summary:** I encountered an issue with soccerdata while parsing HTML for certain events in FBref. **Details:** The error occurs in [this line](https://github.com/nachouve/soccerdata/blob/149ecb6a456dc50e0b4f54833c78f6dc6ccc48e4/soccerdata/fbref.py#L987) of the code where the player1 variable is set. Sometimes, there is no <a> tag present here, but it has the name of person who was issued with a yellow card, for example. **Steps to Reproduce:** ```python import soccerdata as sd fbref = sd.FBref(seasons=['2324'], leagues=["ESP-La Liga"]) fbref.read_events(match_id="e8867e6b") ``` **Expected Behavior:** The read_events() function should handle cases where the <a> tag is missing gracefully, rather than causing an error.
kerem 2026-03-02 15:55:46 +03:00
Author
Owner

@nachouve commented on GitHub (Apr 17, 2024):

Issue Update:
It appears that the changes made in this commit address the reported problem.

Request for Review:
As I'm not familiar with some of the technologies used in the project, @probberechts I would appreciate any guidance on potential improvements or corrections needed before merging the fix.

Thank you in advance for your assistance.

<!-- gh-comment-id:2062119907 --> @nachouve commented on GitHub (Apr 17, 2024): **Issue Update:** It appears that the changes made in [this commit](https://github.com/nachouve/soccerdata/commit/e0d49f82cd78874544c7c946d239f8635cdb3581) address the reported problem. **Request for Review:** As I'm not familiar with some of the technologies used in the project, @probberechts I would appreciate any guidance on potential improvements or corrections needed before merging the fix. Thank you in advance for your assistance.
Author
Owner

@probberechts commented on GitHub (Apr 18, 2024):

I've added a suggestion on how to implement this a bit more cleaner. But functionally, your fix seems ok. Would you be able to create a pull request?

<!-- gh-comment-id:2063479262 --> @probberechts commented on GitHub (Apr 18, 2024): I've added a suggestion on how to implement this a bit more cleaner. But functionally, your fix seems ok. Would you be able to create a pull request?
Author
Owner

@nachouve commented on GitHub (Apr 18, 2024):

I've added a suggestion on how to implement this a bit more cleaner. But functionally, your fix seems ok. Would you be able to create a pull request?

Perfect. I'll do it. Thank you!

<!-- gh-comment-id:2065099318 --> @nachouve commented on GitHub (Apr 18, 2024): > I've added a suggestion on how to implement this a bit more cleaner. But functionally, your fix seems ok. Would you be able to create a pull request? Perfect. I'll do it. Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/soccerdata#98
No description provided.