Forum Discussion

Re: EASHL API Disabled?

Seems like the curl command needs a few non-default header values since the change.

I'm having success adding the following values:

Accept-Language: en-US,en;q=0.5

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0

Connection: keep-alive

Example using OPs example as a building block:

curl --referer www.ea.com "https://proclubs.ea.com/api/nhl/members/stats?clubId=76815&platform=ps4" -H "Accept-Language: en-US,en;q=0.5" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0" -H "Connection: keep-alive"

10 Replies

  • RampantAI's avatar
    RampantAI
    Seasoned Rookie
    4 years ago

    Lol just came to post this as my web guru was like BAM stats are BACK!!

  • Awesome, thanks for finding a solution! Is this a standard curl template that you tried and happened to work, or were you able to determine the solution from the error message after attempting the command in my OP?

  • PlayoffError's avatar
    PlayoffError
    Hero
    4 years ago
    @Georgeandpfunk Ended up being a bit of trial and error actually. Command-line curl was hanging indefinitely for me, but like you I was able to get the data via a web browser.

    From there I just started looking at the header values the browser was sending in the request and seeing how that differed from what curl was doing. End up narrowing it down to the three header values.
  • lounatic99's avatar
    lounatic99
    4 years ago
    @PlayoffError it works locally but when i upload it to the server i get an error. I think they need to approve our IP address...
  • PlayoffError's avatar
    PlayoffError
    Hero
    4 years ago
    @lounatic99 It seems unlikely they're maintaining a whitelist of IP addresses ( I know mine wouldn't be on such a list ).

    What error are you getting on your server? Do you have access to the server? If so, try running curl with the -v parameter to get more detailed output.
  • jaarons's avatar
    jaarons
    4 years ago

    It looks like Akamai (EA's CDN provider) is blocking a ton of IPs from data centers likely in a way to cut down on aggressive/malicious bot behavior. Unfortunately it's a widespread block so clean or unused IPs get picked up in that net.

    I have access to servers in multiple locations (Montreal, Dallas, Tampa, Utah, and Virginia). I used a few servers in each to test API calls - including from IPs that have not been used for outbound network in years - and they were all effectively blocked. I ended up tunneling my requests through a paid VPN service and it works great.

    Can't thank you @PlayoffError  and @Georgeandpfunk enough for your work you guys have done.

    As an aside, any chance either of you have figured out a workaround for fights being double-counted in skpims? I've only been tracking club & skater stats for about a week now but any fighting majors show as 10 minutes and not 5 in the skpims field. I am not sure if other majors are counted correctly.

  • Hey, thanks for the kudos.

    I've never noticed the issue with fighting PIMs being double counted. If it were me, I'd just do some cleanup after receiving the data like:

    PIM = PIM - (#Fights * 5)

  • BTW8892's avatar
    BTW8892
    New Novice
    3 years ago

    Anyone having issues with this recently? I'm using the API to pull game/player data for clubs using PHP. I'm able to get it working just fine on my localhost, but as soon as I upload the same code to my server it returns a 403 - Forbidden HTTP Code. It looks like there seems to be a slight difference in the header size being sent from my localhost compared to the one being sent from the server.

    Any idea if anything has changed with it recently?

  • I just ran this script and it works fine, just grab the stuff you need from it.

    ```

    #!/bin/bash

    cd local/storage

    team1=

    team1csv=

    curl --referer www.ea.com "https://proclubs.ea.com/api/nhl/clubs/matches?clubIds=$team1&platform=common-gen5&matchType=club_private" -H "Accept-Language: en-US,en;q=0.5" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0" -H "Connection: keep-alive" | jq -r ' def empty_strings: reduce range(length) as $i ([]; . + [""]); .[] | [.matchId, .timestamp] as [$matchId, $timestamp] | (.players | [to_entries[] | .key as $id1 | .value | to_entries[] | [$id1, .value.opponentClubId, .key, .value.teamSide, .value.posSorted, .value.playername, .value.toiseconds, .value.ratingDefense, .value.ratingOffense, .value.ratingTeamplay, .value.skgoals, .value.skassists, .value.skshots, .value.skshotattempts, .value.skpasses, .value.skpassattempts, .value.sksaucerpasses, .value.skpossession, .value.skplusmin, .value.skhits, .value.skbs, .value.skdeflections, .value.skgiveaways, .value.sktakeaways, .value.skinterceptions, .value.skpkclearzone, .value.skpim, .value.skpenaltiesdrawn, .value.skfow, .value.skfol, .value.skgwg, .value.skppg, .value.skshg, .value.glsaves, .value.glshots, .value.glga, .value.glbrksaves, .value.glbrkshots, .value.glpensaves, .value.glpenshots, .value.gldsaves, .value.glpkclearzone, .value.glpokechecks, .value.glsoperiods]]) as $players | (.clubs | [to_entries[] | [.key,.value.opponentClubId, .value.teamSide, .value.details.name, .value.toa, .value.ppg, .value.ppo]]) as $clubs | range([$players, $clubs] | map(length) | max) | [$timestamp, $matchId] + ($players[.] // ($players[] | empty_strings)) + ($clubs[.] // ($clubs[] | empty_strings)) | @csv ' >> $team1csv

    csvstack -H *.csv >> ALLSTATS12a.csv

    sleep 5

    awk '{if (!($0 in x)) {print $0; x[$0]=1} }' ALLSTATS12a.csv > ALLSTATS12b.csv

    rclone copy local/storage STATS:Stats

    ```

About NHL Franchise Discussion

Long-time fan? Tell us about your knowledge with the sport and the game franchise in our NHL Franchise community forum.17,627 PostsLatest Activity: 2 days ago