Page 27 of 82 FirstFirst ... 17 25 26 27 28 29 37 77 ... LastLast
Results 261 to 270 of 814

Thread: Dota 2 Match History WebAPI

  1. #261
    Please add "skill" to the GetMatchDetails results, the same one that is in the GetMatchHistory query parameters.

  2. #262
    Basic Member
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by Lazze View Post
    If you are using PHP, use the following in case your server is running 64-bit:

    PHP Code:
    function getAccountID($steam_id){ 
        
    $account_id substr(decbin($steam_id), 32); 
        
    $account_id bindec($account_id); 
         
        return 
    $account_id

    this is awesome. it works great on 64bit, but what about x86?

  3. #263
    Basic Member
    Join Date
    Oct 2011
    Posts
    28
    Quote Originally Posted by Smrth View Post
    this is awesome. it works great on 64bit, but what about x86?
    On 32-bit systems, you have to do it this way:
    Code:
    SteamID - 76561197960265728
    In words, subtract 76561197960265728 from the 64-bit SteamID and you will get the AccountID. All credit goes to Alesix for figuring this out.

  4. #264
    Basic Member MuppetMaster42's Avatar
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    585
    Quote Originally Posted by Lazze View Post
    If you are using PHP, use the following in case your server is running 64-bit
    In the case you don't use 64-bit php (works on 32- and 64-bit) - you have to have the gmp extenison installed (usually just need to uncomment php_gmp.dll in your php.ini)

    PHP Code:
    define("STEAM_ID_UPPER_32_BITS""00000001000100000000000000000001");
        
    // gets the lower 32-bits of a 64-bit steam id
        
    function GET_32_BIT ($ID_64) {
            
    $upper gmp_mulbindec(STEAM_ID_UPPER_32_BITS) , "4294967296" );
            return 
    gmp_strval(gmp_sub($ID_64,$upper));
        }

        
    // creates a 64-bit steam id from the lower 32-bits
        
    function MAKE_64_BIT $ID_32$hi false ) {
            if (
    $hi === false) {
                
    $hi bindec(STEAM_ID_UPPER_32_BITS);
            }

            
    // workaround signed/unsigned braindamage on x32
            
    $hi sprintf "%u"$hi );
            
    $ID_32 sprintf "%u"$ID_32 );

            return 
    gmp_strval gmp_add gmp_mul $hi"4294967296" ), $ID_32 ) );      
        } 
    i.e.
    PHP Code:
    $my_64_id "76561197986553915";
    $my_32_id "26288187";


    $calc_32 GET_32_BIT($my_64_id); // gives "26288187"
    $calc_64 MAKE_64_BIT($my_32_id); // gives "76561197986553915" 
    note that the numbers must be stored as strings.


    edit:
    Quote Originally Posted by Lazze View Post
    On 32-bit systems, you have to do it this way:
    Code:
    SteamID - 76561197960265728
    In words, subtract 76561197960265728 from the 64-bit SteamID and you will get the AccountID. All credit goes to Alesix for figuring this out.
    that shouldn't work because you're using 64-bit arithmetic to do the subtraction which you can't do on a 32-bit php.....

    edit:
    i should correct myself; that WON'T work because 32-bit php stores 64-bit numbers as floats, which means the result will not be the correct steam ID because of rounding errors.
    (I found that out the hard way!)
    Last edited by MuppetMaster42; 08-09-2012 at 05:53 PM.

  5. #265
    Basic Member
    Join Date
    Nov 2011
    Posts
    149
    Some of the match histories are failing because they appear to have invalid encoding. It's pretty infrequent and I think it's only the older ones.
    Some python test code to demonstrate the problem:
    Code:
    from urllib import urlencode
    from urllib2 import urlopen, HTTPError
    from json import loads
    from time import time
    
    key = 'enter your key here'
    
    def get_text(url, parameters=None, retries=9):
        if(parameters):
            url += "?" + urlencode(parameters)
        for attempt in range(retries):
            try:
                response = urlopen(url)
                encoding = response.headers['content-type'].split('charset=')[-1]
                text = response.read()
                text = text.decode(encoding)
                response.close()
                return text
            except HTTPError as e:
                ex = e
                delay = int(2 ** attempt)
                print("HTTP Error {code} on attempt {attempt}, trying again in {delay} seconds.".format(code=e.code, attempt=attempt))
                time.sleep(delay)
        raise ex
    
    def get_JSON(url, parameters=None, retries=9):
        return loads(get_text(url, parameters, retries))
    
    print("Example match history that works:")
    print(get_JSON('http://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/', {'key':key}))
    
    print("\r\n")
    
    print("Example match history that fails:")
    print(get_JSON('http://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/', {'skill':1, 'start_at_match_id':1269337, 'date_max':1323434459, 'key':key}))

  6. #266
    Basic Member MuppetMaster42's Avatar
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    585
    Quote Originally Posted by Wyrm View Post
    Some of the match histories are failing because they appear to have invalid encoding. It's pretty infrequent and I think it's only the older ones.
    Some python test code to demonstrate the problem:
    I was gonna say that maybe there were no matches that fit that request, but i can't get anything from the servers right now....

  7. #267
    Confirming that it appears to be broken right now.

  8. #268
    Valve Developer Zoid's Avatar
    Join Date
    Sep 2011
    Posts
    1,065
    The Match API has been disabled for performance reasons at this time. We hope to restore it after making some adjustments tomorrow.

  9. #269
    Basic Member
    Join Date
    Mar 2012
    Posts
    51
    Quote Originally Posted by Zoid View Post
    The Match API has been disabled for performance reasons at this time. We hope to restore it after making some adjustments tomorrow.
    ohhh i was thinking that my key is banned...

  10. #270
    Basic Member
    Join Date
    Jul 2012
    Posts
    11
    It would be great to create option of fetching just the match id and nothing else from "match history" API method. It could be activated aby URL parameter like: match_id_only=1 etc.

    For that option maximum number of returned matches should be increased - simply because match id is much less data than information about participating players, start of the match etc.

    It could decrease number of API calls/requests for people who for example just want to find all matches in some range of time and later fetch detailed infomation about the games from " details of a match" API method.
    Last edited by BlueCloud; 08-10-2012 at 01:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •