2014 Alternative leaderboard with country filtering

  • Thread starter Hardyx
  • 15 comments
  • 1,997 views
75
Cuba
Barcelona
hardyxx
Hi guys, I've seen a bunch of people complaining about the lack of country filtering on the official leaderboard lately so I decided to spend my lunch time creating an alternative leaderboard. It's quite rudimentary, yet it works as it's supposed to work. It's hosted on a free Heroku dyno, so it may be slow the first time is accessed after an hour of inactivity.

Here's the link: http://gta2014.herokuapp.com/

Hope you like it.
 
Last edited:
Hi guys, I've seen a bunch of people complaining about the lack of country filtering on the official leaderboard lately so I decided to spend my lunch time creating an alternative leaderboard. It's quite rudimentary, yet it works as it's supposed to work. It's hosted on a free Heroku dyno, so it may be slow the first time is accessed after an hour of inactivity.

Here's the link: http://gta2014.herokuapp.com/

Hope you like it.

Nice board. I don't think it filters countries properly though. May need a little bit more work to get that right.
 
Clicking the flag/country tab does nothing. All other filtering tabs seem to be working alright.

Well, the "right" way to filter by country is to use the country list at the upper right side since it recalculates the gap, adds a column with the country rank, etc. But let me see if I can get this to work.

EDIT: Fixed
 
Last edited:
That is a nice leaderboard. My biggest complaint isn't the lack of sorting by country, but the limited number that is available, 250. I know this round doesn't mean a whole lot, but it would be more entertaining to know my US/North America ranking than to know that I'm 3000th worldwide.

But for the data available, you did a very nice job.
 
That is a nice leaderboard. My biggest complaint isn't the lack of sorting by country, but the limited number that is available, 250. I know this round doesn't mean a whole lot, but it would be more entertaining to know my US/North America ranking than to know that I'm 3000th worldwide.

But for the data available, you did a very nice job.

Yeah, as you said this is the only data "publicly" available, so I can't do much more. I've been trying to catch the requests made by the ps3 to the server but as expected they're tunneled through SSL so without a jailbreaked ps3 I'm unable to see what's going on.

Anyway, glad you like it :)
 
Don't suppose you can tell me how you scraped the data? I keep getting a out of domain error on the POST request.

Any tips?
 
Okay guys, sorry for the delay, just added round 3. Have fun!

Don't suppose you can tell me how you scraped the data? I keep getting a out of domain error on the POST request.

Any tips?

Sure! You have to make a POST request to http://www.gran-turismo.com/us/api/gt6/ranking/ with the following body:

job=1&board_id=[board_id]&begin_rank=1&end_rank=250&dtype=0

Replace [board_id] with one of these codes depending on the round you want to obtain:

1 => 'lO4B2gAjpTY', 2 => 'zNhZpSjGkq0', 3 => 'X6amGC0Fl94'

Hope it helps.

3Ig61AQTclCg_rS8-_wKKH1uSbdjItq1Evr8cLMFaDI
 
Last edited:
Hope it helps.

Yeah.. no, not really.. I can do the request from within Postman OK, but I can't get it to work from my JS code on my page. Are you doing the calls in PHP on the backend?
 
Yeah.. no, not really.. I can do the request from within Postman OK, but I can't get it to work from my JS code on my page. Are you doing the calls in PHP on the backend?

Nope, I'm using Ruby with the Faraday gem. Post your code and I'll try to help you.
 
Code:
function gtrequest() {
    var html = "response<br/>";
    $.post('http://www.gran-turismo.com/au/api/gt6/ranking/?job=1&board_id=lO4B2gAjpTY&begin_rank=1&end_rank=250&dtype=0',function(data){
        for (d in data) {
            html+=d;
        }
        $('#debug').html(html);
    });
}

Response (From Chrome debugger)
Code:
XMLHttpRequest cannot load http://www.gran-turismo.com/au/api/gt6/ranking/?job=1&board_id=lO4B2gAjpTY&begin_rank=1&end_rank=250&dtype=0. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.*.*' is therefore not allowed access.
 
That's because their CORS policy, and since you don't have control over the headers returned by the server you can't make requests outside the gran-turismo.com domain. I'm afraid your only option is to retrieve the data on the backend.

I've added a JSON endpoint to my app with cross origin allowed, try this:

HTML:
$.get('http://gta2014.herokuapp.com/1.json')

Replace the '1' with the round you want
 
Last edited:
That's because their CORS policy, and since you don't have control over the headers returned by the server you can't make requests outside the gran-turismo.com domain. \

Which leaves the question how does yours work?

as for your JSON response... that will work for me.. Thanks!
 
Back