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

  • Originally posted by walkingcarpet View Post
    It seems that the zip no longer contains the json file.
    Whoops, my bad. I've added it now.

    Comment


    • Let's assume for a moment that valve won't be providing a full dataset for us; would anyone else be up for joining together to divide and conquer? Doing all games for a specific region and difficulty 1 month at a time would be somewhat manageable and even with only ~10 people it would "only" take us a month to get everything completely downloaded. Splitting the data up sensibly to avoid repitition is the key concern. I'm lurking on freenode IRC in ##dota2webapi if people would be interested in sharing data and splitting the workload.
      Last edited by Wyrm; 07-27-2012, 11:20 AM.

      Comment


      • Originally posted by ragedmonkey View Post
        Hey guys,

        Im still a bit confused how to to convert from SteamID to Account ID.

        For Example, this is my SteamID

        http://steamcommunity.com/profiles/76561197969130713
        OR
        STEAM_0:1:4432492

        What do I have to do to end up with this Account # 31609526 ??

        Thanks in Advanced.
        As Alesix have previously mentioned, if you are not running a 64-bit OS on your server, it can be a bit difficult to do. I would suggest you read his previous post in that case.

        If you are running a 64-bit OS on the other hand, it is quite easy. You simply convert the SteamID to binary, get the first 32 bits and convert them back to decimal. That is the AccountID.

        If you are developing in PHP, you can use the following function:

        Originally posted by Lazze View Post
        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 Lazze View Post
          As Alesix have previously mentioned, if you are not running a 64-bit OS on your server, it can be a bit difficult to do. I would suggest you read his previous post in that case.

          If you are running a 64-bit OS on the other hand, it is quite easy. You simply convert the SteamID to binary, get the first 32 bits and convert them back to decimal. That is the AccountID.

          If you are developing in PHP, you can use the following function:
          Thanks, im not currently using PHP (using Python) and am wondering if there any other method that is non system specific.

          My site: http://www.dota2dmg.com/31609526

          Comment


          • I tried doing the conversion in Python. But it isnt getting the result i want.

            Can anyone see if anything is wrong here?

            http://codepad.org/4cxPU1vV

            Comment


            • Originally posted by ragedmonkey View Post
              Thanks, im not currently using PHP (using Python) and am wondering if there any other method that is non system specific.

              My site: http://www.dota2dmg.com/31609526
              This works for me in 32 bit php, assuming you have bc math installed.

              PHP Code:
              <?php

              function dec2bin_i($decimal_i) {
                
              bcscale(0);

                
              $binary_i '';
                do {
                  
              $binary_i bcmod($decimal_i,'2') . $binary_i;
                  
              $decimal_i bcdiv($decimal_i,'2');
                } while (
              bccomp($decimal_i,'0'));

                return(
              $binary_i);
              }

              function 
              bin2dec_i($binary_i) {
                
              bcscale(0);

                
              $decimal_i '0';
                for (
              $i 0$i strlen($binary_i); $i++) {
                  
              $decimal_i bcmul($decimal_i,'2');
                  
              $decimal_i bcadd($decimal_i,$binary_i[$i]);
                }
               
                return(
              $decimal_i);
              }

              $xml simplexml_load_string(file_get_contents('http://steamcommunity.com/id/random_guy?xml=1'));
              $binary dec2bin_i($xml->steamID64);
              $steam_id bin2dec_i(substr($binarystrlen($binary) - 3232));

              echo 
              'Steam ID: ' $steam_id;

              ?>

              Comment


              • Originally posted by ragedmonkey View Post
                I tried doing the conversion in Python. But it isnt getting the result i want.

                Can anyone see if anything is wrong here?

                http://codepad.org/4cxPU1vV
                Your script works for my steam id. I can't get it to work on yours though (my php doesn't work on yours either :P)... odd

                Comment


                • Originally posted by Metroids View Post
                  Your script works for my steam id. I can't get it to work on yours though (my php doesn't work on yours either :P)... odd
                  That is weird..... anyone know WHY WHYYYYYYYYYYYYYYY?

                  Comment


                  • Originally posted by ragedmonkey View Post
                    Hey guys,

                    Im still a bit confused how to to convert from SteamID to Account ID.

                    For Example, this is my SteamID

                    http://steamcommunity.com/profiles/76561197969130713
                    OR
                    STEAM_0:1:4432492

                    What do I have to do to end up with this Account # 31609526 ??

                    Thanks in Advanced.
                    76561197969130713's account_id is actually 8864985, not 31609526. It's actually your other account that has the account_id of 31609526.

                    Ragedmonkey: http://steamcommunity.com/profiles/76561197969130713 (76561197969130713 - 76561197960265728 = 8864985)
                    DotaDmg.com: http://steamcommunity.com/profiles/76561197991875254 (76561197991875254 - 76561197960265728 = 31609526)

                    Another quick tip for everyone:
                    To convert between STEAM_0:X:XXXXXXX to account_id, just multiply the longer number by 2 and add the single-digit number to it. For Ragedmonkey's case, it's 4432492 * 2 + 1 = 8864985.

                    To find out more about SteamID, check this article out: https://developer.valvesoftware.com/wiki/SteamID
                    Last edited by Alesix; 07-27-2012, 04:45 PM.

                    Comment


                    • Originally posted by vtFurlin View Post
                      Edit: Is there a difference between XML and JSON? Will any of the two return the data faster (from Valve's side)?
                      For me it looks like JSON has less useless data and therefor is faster, anyone confirm?
                      from what i've seen, the XML results are usually about 33% larger than JSON.

                      I think you'll find that it takes the same amount of time to generate the results, regardless of format.
                      the only difference is the time taken to send the extra data (which unless you're constantly fetching results from valve, shouldn't be a problem).

                      that being said, i still use json because it is nicer than xml...



                      also, instead of looking for free hosting, if you use windows, just download EasyPHP from this link.

                      The installer will automatically install and configure an apache server with php, and a mysql server locally on your computer.
                      The API Bible: Things You Should Know Before Starting API Development

                      Comment


                      • from what i've seen, the XML results are usually about 33% larger than JSON.
                        Just a randomly picked match details & match history shows that json is a bit smaller. JSON seems like the way to go in terms of bandwidth usage when dealing with thousands of matches at a time

                        match details JSON -> 5551
                        match details XML -> 7901

                        match history JSON -> 33760
                        match history XML -> 47726

                        Comment


                        • Figured I might as well post my python interface to the stats API here: http://dev.dota2.com/showthread.php?t=48664

                          Does the basic stuff like getting match history and getting match details, but I threw a few extras in like attempting to determine the skill level for a particular match.
                          Steam Profile
                          Python Interface to the Stats API
                          Suggestion: Courier Shift-Queue Improvements
                          Make Disablehelp work on Decrepify
                          Useful link for mute system supporters

                          Comment


                          • We have implemented a feature to view match details for the user's replays.
                            IMHO, the API is not enough usefull because you can not get the details of private matches. Most interesting information is about top team's matches with streamers comments. But we can't get it.
                            dotavideo.ru developer

                            Comment


                            • What really bugs me is that before this patch, you could access practice games info with the API, but since the newest patch, Valve has "fixed" that problem.

                              Comment


                              • Originally posted by Drkirby View Post
                                What really bugs me is that before this patch, you could access practice games info with the API, but since the newest patch, Valve has "fixed" that problem.
                                exactly ... we can't access private lobby anymore ...
                                sorry for my bad English ...

                                From Vietnam with Love - Lagest DOTA 2 Community in Vietnam: DotA-2.Vn

                                Comment

                                Working...
                                X