ffverse / ffscrapr

R API Client for Fantasy Football League Platforms
https://ffscrapr.ffverse.com
Other
81 stars 22 forks source link

ESPN issue. #431

Open Borgjohn715 opened 1 month ago

Borgjohn715 commented 1 month ago

Good afternoon,

It looks like ESPN isn't able to pull info for my private league based on the URL. Can you help?

tanho63 commented 3 weeks ago

Can you provide a reprex and the output of ffscrapr::ff_sitrep()?

Borgjohn715 commented 2 weeks ago

sorry newbie here. What is a reprex below is the sitrep.

── System Info ───────────────────────────────────────────────────────────────
• R version 4.3.1 (2023-06-16) • Running under: macOS Monterey 12.7.6
── Package Status ────────────────────────────────────────────────────────────
   package installed  cran      dev behind
1 ffscrapr  1.4.8.18 1.4.8 1.4.8.18       
── Package Options ───────────────────────────────────────────────────────────
• No options set for above packages
── Package Dependencies ──────────────────────────────────────────────────────
• askpass    (1.2.0)   • grDevices (4.3.1)  • ratelimitr (0.4.1)  
• assertthat (0.2.1)   • httr      (1.4.7)  • rlang      (1.1.4)  
• backports  (1.5.0)   • jsonlite  (1.8.8)  • stats      (4.3.1)  
• cachem     (1.1.0)   • lifecycle (1.0.4)  • stringi    (1.8.4)  
• checkmate  (2.3.2)   • magrittr  (2.0.3)  • stringr    (1.5.1)  
• cli        (3.6.3)   • memoise   (2.0.1)  • sys        (3.4.2)  
• cpp11      (0.4.7)   • methods   (4.3.1)  • tibble     (3.2.1)  
• curl       (5.2.1)   • mime      (0.12)   • tidyr      (1.3.1)  
• data.table (1.15.4)  • nflreadr  (1.4.1)  • tidyselect (1.2.1)  
• dplyr      (1.1.4)   • openssl   (2.2.1)  • tools      (4.3.1)  
• fansi      (1.0.6)   • pillar    (1.9.0)  • utf8       (1.2.4)  
• fastmap    (1.2.0)   • pkgconfig (2.0.3)  • utils      (4.3.1)  
• generics   (0.1.3)   • purrr     (1.0.2)  • vctrs      (0.6.5)  
• glue       (1.7.0)   • R6        (2.5.1)  • withr      (3.0.1)  
• graphics   (4.3.1)   • rappdirs  (0.3.3)    
── Not Installed ─────────────────────────────────────────────────────────────
• ffsimulator  • ffpros  • ffopportunity  
tanho63 commented 2 weeks ago

It means reproducible example. In general, this means to provide (in text format) the espn_connect call, the ffscrapr function you are running, and the error message you are receiving.

You will want to blank out the authentication details for your private league.

ekatz-BLA commented 2 weeks ago

Here's an example:

> conn <- espn_connect(
    season = season,
    league_id = 772791,
    espn_s2 = EHT_ESPN_S2,
    swid = EHT_SWID
  )

  > starter_info <- ff_starter_positions(conn)
Error in espn_getendpoint_raw(conn, url_query, xff) : 
  object 'parsed' not found
In addition: Warning message:
ESPN API did not return json while calling https://fantasy.espn.com/apis/v3/games/ffl/seasons/2024/segments/0/leagues/772791?view=mSettings 

sitrep:

── System Info ─────────────────────────────────────────────────────────────────────
• R version 4.0.4 (2021-02-15) • Running under: macOS Big Sur 10.16
── Package Status ──────────────────────────────────────────────────────────────────
   package installed  cran      dev behind
1 ffscrapr     1.4.8 1.4.8 1.4.8.18    dev
── Package Options ─────────────────────────────────────────────────────────────────
• No options set for above packages
── Package Dependencies ────────────────────────────────────────────────────────────
• askpass    (1.1)     • glue      (1.4.2)  • R6         (2.5.0)   
• assertthat (0.2.1)   • graphics  (4.0.4)  • rappdirs   (0.3.3)   
• backports  (1.2.1)   • grDevices (4.0.4)  • ratelimitr (0.4.1)   
• cachem     (1.0.4)   • httr      (1.4.2)  • rlang      (0.4.10)  
• checkmate  (2.0.0)   • jsonlite  (1.7.2)  • stats      (4.0.4)   
• cli        (3.6.3)   • lifecycle (1.0.0)  • stringi    (1.5.3)   
• cpp11      (0.2.7)   • magrittr  (2.0.1)  • stringr    (1.4.0)   
• crayon     (1.4.1)   • memoise   (2.0.0)  • sys        (3.4)     
• curl       (4.3)     • methods   (4.0.4)  • tibble     (3.1.0)   
• data.table (1.14.0)  • mime      (0.10)   • tidyr      (1.1.3)   
• dplyr      (1.0.5)   • nflreadr  (1.4.1)  • tidyselect (1.1.0)   
• ellipsis   (0.3.1)   • openssl   (1.4.3)  • tools      (4.0.4)   
• fansi      (0.4.2)   • pillar    (1.6.0)  • utf8       (1.2.1)   
• fastmap    (1.1.0)   • pkgconfig (2.0.3)  • utils      (4.0.4)   
• generics   (0.1.0)   • purrr     (0.3.4)  • vctrs      (0.3.7)   

SWID and S2 match what I'm seeing in Cookies when inspecting the espn site

tanho63 commented 2 weeks ago

Please restart your session and then install the devel version https://github.com/ffverse/ffscrapr?tab=readme-ov-file#installation

install.packages("ffscrapr", repos = c("https://ffverse.r-universe.dev", getOption("repos")))
ekatz-BLA commented 2 weeks ago

That worked for me! Thank you for the fix

tanho63 commented 2 weeks ago

Cool! Just waiting for @Borgjohn715 to also confirm that it fixed the issue before closing.