pybaseball icon indicating copy to clipboard operation
pybaseball copied to clipboard

Implement new FanGraphs Leaderboard API

Open ss77995ss opened this issue 1 year ago • 0 comments

Description

  • FanGraphs update their leaderboard page in 2023. Therefore the old data scraping does not work. Currently, we use their legacy url https://www.fangraphs.com/leaders-legacy.aspx now. But the legacy one might not update after 2023.
    • ref: https://blogs.fangraphs.com/weve-updated-our-major-league-leaderboards-interface/
    • related issue: https://github.com/jldbc/pybaseball/issues/376
  • To use latest leaderboard, apply fangraph's leaderboard api to get the data
    • url: link
    • commit: https://github.com/jldbc/pybaseball/commit/0f39311b63df54c50eac0d1e2eed16cdd9b73c56
  • Add a legacy flag to remain obtaining data from legacy leaderboard. Also add a notification in document
    • commit: https://github.com/jldbc/pybaseball/commit/7205275fdf4a53abcf70df186a4930625c3014e5, https://github.com/jldbc/pybaseball/commit/ec9e2bc4c5cc84749f30904ec33df0b042817084

Need Discussions

  • Currently all the params seem to work but I am not check completely. Might need more testing.
  • Test will not pass since the response data is different between legacy and latest leaderboard. Need some help for the testing data
  • Look like issue: https://github.com/jldbc/pybaseball/issues/396 can also be fixed if we use fangraphs api link

TODO

  • [ ] Fix testing
  • [ ] Delete demo commit

ss77995ss avatar Jan 23 '24 17:01 ss77995ss