mjk2244 / pro-football-reference-web-scraper

Web scraper to retrieve player and team data from Pro Football Reference.
https://mjk2244.github.io/pro-football-reference-web-scraper/
Apache License 2.0
29 stars 20 forks source link

players with similar names player_game_log.py #8

Closed mjk2244 closed 1 year ago

mjk2244 commented 1 year ago

player_game_log.py currently cannot accommodate players who have names similar to other players. The current functionality assumes that a player's game log can be found at the following url: https://www.pro-football-reference.com/players//00/gamelog//. However, players with names similar to other players may have a different url.

For example, the game log of Josh Allen (current Buffalo Bills QB) can be found at the following url: https://www.pro-football-reference.com/players/A/AlleJo02/gamelog/2022/. "AlleJo00" belongs to a different player named Josh Allen. There are countless other examples, including Damien Harris (https://www.pro-football-reference.com/players/H/HarrDa06.htm), Christian McCafrrey (https://www.pro-football-reference.com/players/M/McCaCh01.htm) and Davante Adams (https://www.pro-football-reference.com/players/A/AdamDa01.htm). As a result, the wrong pages are being scraped in cases like these.

In the case of Josh Allen, a potential solution may be to go to https://www.pro-football-reference.com/players/A/ and retrieve the href for the correct Josh Allen. Analogous steps could also be taken for other names.