Gran Turismo 7: DR Stats are now available on the website - how to access programmatically?

GrumpyOldMan

Premium
1,764
United States
Southern California
dagware
I don't really know where to ask this, so I'm hoping this will get me pointed in the right direction.

I'm the author of GranTracker, and I currently retrieve a person's DR/SR status by inspecting a screenshot the user provides, looking at the DR and SR percentage bars.

Someone just noticed that the Profile page of the GranTurismo website now shows DR/SR letters, along with a DR percent bar, like this:

1711407780100.png


I was wondering if anyone's done any research into retrieving this information, programatically? I mean, I can scrape the web page (if the user is signed in), but that's subject to change without notice, Maybe there's a new API available?

Any help would be appreciated that could point me in the right direction. Thanks.
 
I don't really know where to ask this, so I'm hoping this will get me pointed in the right direction.

I'm the author of GranTracker, and I currently retrieve a person's DR/SR status by inspecting a screenshot the user provides, looking at the DR and SR percentage bars.

Someone just noticed that the Profile page of the GranTurismo website now shows DR/SR letters, along with a DR percent bar, like this:

View attachment 1340412

I was wondering if anyone's done any research into retrieving this information, programatically? I mean, I can scrape the web page (if the user is signed in), but that's subject to change without notice, Maybe there's a new API available?

Any help would be appreciated that could point me in the right direction. Thanks.
It doesn't appear to do exactly what it did before (unless I'm being dim) but if you inspect that specific element (depending on your browser: right-click, inspect) it gives a percentage for the bar:

1711410516496.png

1711410591290.png


96.39% would equal 19,278pt of the 20,000pt required to progress from B to A, or 29,278pt in total.

Every profile I've checked (edit: except A+ drivers, who are all showing 100% for some reason), this value matches what I'd estimate the white bar percentage as. For example:

1711410932702.png


36.155 = 10,000+7,231 = 17,231

From what I recall of Gran Tracker, it's the same thing but with a precise percentage rather than having to estimate from the number of pixels in the bar from in-game screengrabs.

I can't see the actual number from the same processes used in GT Sport though.
 
Last edited:
Thank you - I appreciate the sleuthing.
Every profile I've checked
So you can see the information for other profiles? How did you manage that? (Forgive me if it's obvious, sometimes I can be quite thick.)
 
Following this thread hoping this will turn out to give us precise information with minimum inconvenience.

Thank you - I appreciate the sleuthing.

So you can see the information for other profiles? How did you manage that? (Forgive me if it's obvious, sometimes I can be quite thick.)
You can find other drivers. Just go to the sport mode page, then time trials or gtws races and you can open the profiles of the drivers that show up in the rankings.
 
It doesn't appear to do exactly what it did before (unless I'm being dim) but if you inspect that specific element (depending on your browser: right-click, inspect) it gives a percentage for the bar:

View attachment 1340416
View attachment 1340417

96.39% would equal 19,278pt of the 20,000pt required to progress from B to A, or 29,278pt in total.

Every profile I've checked (edit: except A+ drivers, who are all showing 100% for some reason), this value matches what I'd estimate the white bar percentage as. For example:

View attachment 1340420

36.155 = 10,000+7,231 = 17,231

From what I recall of Gran Tracker, it's the same thing but with a precise percentage rather than having to estimate from the number of pixels in the bar from in-game screengrabs.

I can't see the actual number from the same processes used in GT Sport though.
This is also valid for rank S drivers who have a full gray DR bar. It's the same as the A+ but full gray this time. We will probably expect a fix for A+ and S in the near future
 

Attachments

  • cachedImage.png
    cachedImage.png
    100 KB · Views: 3
I've noticed since yesterday, that my profile page does not show when I try to access it through Firefox (my first choice for browser).
It does show through other browsers though.
So this change locked out Firefox users.
I was wondering if there is a way to report it to PD as I wouldn't want to change browsers.
 
Last edited:
I've noticed since yesterday, that my profile page does not show when I try to access it through Firefox (my first choice for browser).
It does show through other browsers though.
So this change locked out Firefox users.
I was wondering if there is a way to report it to PD as I wouldn't want to change browsers.

I've noticed since yesterday, that my profile page does not show when I try to access it through Firefox (my first choice for browser).
It does show through other browsers though.
So this change locked out Firefox users.
I was wondering if there is a way to report it to PD as I wouldn't want to change browsers.
And also fix the problem of the DR bar for A+ and S which is a bug because two bars are different for the two ranks mentioned
 
Code:
curl "https://web-api.gt7.game.gran-turismo.com/stats/get" -X POST -H "Referer: https://www.gran-turismo.com/" -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_SECRET_SONY_NETWORK_ACCESS_TOKEN" --data-raw "{""user_id"":""GUID_USER_ID"",""year"":2024,""month"":3}"

This returns a json with lots of info. There are other endpoints available.
Unlike back in GT Sport it doesn't return the exact DR rating but a 'driver_rating' (which is a number between 1 and 6, 6 meaning A+) and a 'dr_point_ratio' between 0 and 1 (or 0-0.99 unless you're maxed out A+?) E.g if you're halfway through A it'll return 5 and 0.5.
 
Last edited:
Code:
curl "https://web-api.gt7.game.gran-turismo.com/stats/get" -X POST -H "Referer: https://www.gran-turismo.com/" -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_SECRET_SONY_NETWORK_ACCESS_TOKEN" --data-raw "{""user_id"":""GUID_USER_ID"",""year"":2024,""month"":3}"

This returns a json with lots of info. There are other endpoints available.
Unlike back in GT Sport it doesn't return the exact DR rating but a 'driver_rating' (which is a number between 1 and 6, 6 meaning A+) and a 'dr_point_ratio' between 0 and 1 (or 0-0.99 unless you're maxed out A+?) E.g if you're halfway through A it'll return 5 and 0.5.
Awesome!

Questions:
  1. "Authorization: Bearer YOUR_SECRET_SONY_NETWORK_ACCESS_TOKEN"
    • Is Bearer a constant?
    • Where do I find my YOUR_SECRET_SONY_NETWORK_ACCESS_TOKEN?
  2. GUID_USER_ID
    • Where do I find this? I've a feeling it should be obvious...
Thanks again.
 
This is also valid for rank S drivers who have a full gray DR bar. It's the same as the A+ but full gray this time. We will probably expect a fix for A+ and S in the near future
I'm wondering if it may be intentional, to try to keep A+ drivers from divining their exact ratings? Why, I couldn't tell you, but they seem to not want to give that info out too freely...
 
Awesome!

Questions:
  1. "Authorization: Bearer YOUR_SECRET_SONY_NETWORK_ACCESS_TOKEN"
    • Is Bearer a constant?
    • Where do I find my YOUR_SECRET_SONY_NETWORK_ACCESS_TOKEN?
  2. GUID_USER_ID
    • Where do I find this? I've a feeling it should be obvious...
Thanks again.
1. I found the Bearer Token to be stable across page refreshes, but it should change after logout/login. I don't know for how long it is valid and constant, hours, days maybe? (considering the page sometimes logs me out just because..)

To get this token visit your profile page, press F12 to open your browser's developer tools, switch to the "Network" tab, refresh the profile page again. You should now see a bunch of requests to images and files in the list. Click one of the requests that look like the ones below (get, get_history, get_sport_profile, ...), the token is found in the right pane, highlighted yellow in the screenshot - it's a long bunch of random numbers and letters, never send this to anyone as it identifies your login (I removed mine from the image)
1711490061662.png


2. GUID_USER_ID is found in the URL of a profile, for example my profile URL is https://www.gran-turismo.com/us/gt7/user/mymenu/f7860d1d-c521-4e30-82af-7e4f7ea73cf7/profile then f7860d1d-c521-4e30-82af-7e4f7ea73cf7 is that ID
 
I found the Bearer Token to be stable...
Thanks for all the info! I'm noticing the calls to web-api-gt... and I suspect this is where all the goodies come from (as I'm sure you've already figured out).

I'm not sure if I want to delve into this too deeply, because the logic is sure to change at some point, and (begin TMI) although I definitely have a mechanism for distributing program updates (for GranTracker), it's not the smooth process I wish it was, unless I'm willing to pay a bunch of money, and since the program is free, that's money I don't want to spend.

On the other hand, knowing myself like I do, I won't be able to stop myself from heading down the rabbit trail...

In any case, thanks!!
 
The bearer token expires after 60 minutes and is (re-)generated from the JSESSIONID cookie (which is valid for about a week, or until you log out, and is set upon successful authorization.)

When logged in on your My Page go to the Storage tab in Web Developer Tools (or simply press Shift-F9) in Firefox to view it.

The following snippet will retrieve a json with your user_id GUID and a bearer token (in the 'access_token' field) valid until the Unix epoch time in the 'access_token_expire' field (it's in milliseconds.)
Code:
curl "https://www.gran-turismo.com/us/gt7/info/api/token/" -H "Cookie: JSESSIONID=YOUR_JSESSIONID"

Edit: Or "un-programmatically" (you still have to be signed in): https://www.gran-turismo.com/us/gt7/info/api/token
 
Last edited:
Hmmmm, this could have huge potential! That being said, as much as I'd like to say I am... I am NOT this high level A+. I think I am about 1/3 the way up. But it appears to have the bar virtually maxed out. This is using FireFox.

1711539109407.png


Ignore the above, just saw this:

Every profile I've checked (edit: except A+ drivers, who are all showing 100% for some reason)...


If I go to my EMEA account, using Edge (stop laughing) then it doesn't show a progress bar at all.

1711539223427.png


What browser are you guys using? It might make a difference.
 
Last edited:
Hmmmm, this could have huge potential! That being said, as much as I'd like to say I am... I am NOT this high level A+. I think I am about 1/3 the way up. But it appears to have the bar virtually maxed out. This is using FireFox.

View attachment 1340689

Ignore the above, just saw this:




If I go to my EMEA account, using Edge (stop laughing) then it doesn't show a progress bar at all.

View attachment 1340691

What browser are you guys using? It might make a difference.
A filled A+ bar, on Chrome here.
 
I'm wondering if it may be intentional, to try to keep A+ drivers from divining their exact ratings? Why, I couldn't tell you, but they seem to not want to give that info out too freely...
I don’t think this is intentional because the other ranks (except S) have their progress bar. It was fixed in 2022. And then the S has this bug but with a completely gray bar (0% therefore) and even if the player has this rank and is below 50K, he would still have this bug
 
Last edited:
I'm able to see mine in FF and Chrome.
Must be me then. It is actually the Sony authentication that is erroring out. Can't get in either. I tried clearing cache and everything; well part from rebooting. May have to go all windows on my Mac and reboot! :confused:
 
Must be me then. It is actually the Sony authentication that is erroring out. Can't get in either. I tried clearing cache and everything; well part from rebooting. May have to go all windows on my Mac and reboot! :confused:
It was working for me this morning on my Mac, in Chrome. I'm still logged in now, so everything's fine for me (log-in-wise)
 
I was finally able to get it. Appeared to be a 1password issue sending credentials weird. Manually logging in worked.

I was able to determine I am 77.415% B on my alt account and 31.89% A on my main account. I'm not sure that is all that useful though from a race tracking perspective as it won't have the history, only when you next log in...
 
Last edited:
I was able to determine I am 77.415% B on my alt account
I did three races on the same account tonight and uploaded my results to GranTracker. That had me a 81% (4% gain) and was 77% previously. I just checked the website and that is saying 81.49% so I guess the bar rounds to the nearest whole number (with the bar being 100 pixels wide). We would need a result in the under half of the fraction to see if it rounds up at all, or just rounds down.
 
Last edited:
Hmmmm, this could have huge potential! That being said, as much as I'd like to say I am... I am NOT this high level A+. I think I am about 1/3 the way up. But it appears to have the bar virtually maxed out. This is using FireFox.

View attachment 1340689

Ignore the above, just saw this:




If I go to my EMEA account, using Edge (stop laughing) then it doesn't show a progress bar at all.

View attachment 1340691

What browser are you guys using? It might make a difference.
I am a mid D and I do not see my lines on either account or using either browser. Odd if you ask me. I am going to have to download Chrome and try it there.
 
Last edited:
I replied to Hizal on Twitter/X about the DR A+/S bar display bug and he replied that I took a photo on mobile
IMG_8087.jpeg
 
Last edited:
Back