Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

Dota 2 Match History WebAPI

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I disagree. JS is no problem at all, virtually any browser can handle it.
    And there are people like me who walk with noscript, disallowing the javascript on un-trusted sites. It is not the browser handling capability nowadays but the user disallowing JS.

    I prefer html5/css over javascript if it is possible to be done with somewhat reasonable amount of code required compared to JS counterpart.

    Comment


    • Originally posted by Smrth View Post
      this was maybe answered already but sorry, there's 26 pages in this thread. can someone explain me how to retrieve steamID by given account_id or vice versa. thanks

      p.s. why don't you just use steamID 64 instead of giving every player new numbers?
      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

      Comment


      • Originally posted by Shinkai View Post
        And there are people like me who walk with noscript, disallowing the javascript on un-trusted sites. It is not the browser handling capability nowadays but the user disallowing JS.

        I prefer html5/css over javascript if it is possible to be done with somewhat reasonable amount of code required compared to JS counterpart.
        It can be done in html5/css, but it is completely unnecessary in my opinion. As you pointed out yourself, it is more often than not the user who prevents JS from running on the site, and therefore it is the users own problem. My opinion would have been completely different if it was a browser problem, but it isn't. People who run noscript are a minority, in web development, you don't develop based on the minority. You develop for the majority of people who are likely to visit your site. In this case, I would bet that most of the people who visit a Dota 2 stats site are running on a new browser, and have JS enabled.

        By your logic, we should also revert to html4 and css2 because there is a chance that some people still run IE6, and in that case it would be even harder, if not impossible to do without GD.

        EDIT: Done with edits, lol.
        Last edited by Lazze; 08-09-2012, 03:50 PM.

        Comment


        • I didn't mean that at all. Just pointing out that it is the users, not the browser (unless using really old software who shouldn't even be supported in the first place). Obviously it is users own problem, just a little note saying 'this site requires javascript to function properly' would be sufficient. I wouldn't even know about such "Show/hide Tower Status" feature on your site if I didn't allow JS to see the button. (hint hint )
          Last edited by Shinkai; 08-09-2012, 04:00 PM. Reason: editing..

          Comment


          • Originally posted by Shinkai View Post
            I didn't mean that at all. Just pointing out that it is the users, not the browser (unless using really old software who shouldn't even be supported in the first place). Obviously it is users own problem, just a little note saying 'this site requires javascript to function properly' would be sufficient. I wouldn't even know about such "Show/hide Tower Status" feature on your site if I didn't allow JS to see the button. (hint hint )
            I agree. The user should be able to see that such function exists, and it can be activated by enabling JS

            Comment


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

              Comment


              • 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?

                Comment


                • 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.

                  Comment


                  • 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:
                    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, 05:53 PM.
                    The API Bible: Things You Should Know Before Starting API Development

                    Comment


                    • 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}))

                      Comment


                      • 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....
                        The API Bible: Things You Should Know Before Starting API Development

                        Comment


                        • Confirming that it appears to be broken right now.

                          Comment


                          • The Match API has been disabled for performance reasons at this time. We hope to restore it after making some adjustments tomorrow.

                            Comment


                            • 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...

                              Comment


                              • 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, 01:00 AM.

                                Comment

                                Working...
                                X