Close
View RSS Feed

luxlunae

Querying the api for information about a set of characters (Basic)

Rate this Entry
UPDATE: As of 5/1/2016 this script no longer works. If/when I update it I will place a link here.


I am a spreadsheet fanatic. I "invented" spreadsheets with a paper game I played as a child, and designing spreadsheets for any game I spend a lot of time on is a big chunk of the fun for me. I think it comes from the same part of my brain that enjoys endless tweaking of my multiboxing setup.

At a minimum, I like to have current information about a characters level, ilevel, and professions, and now that this information is available in the api I decided to work on automatically retrieving it. I was inspired by Beeq's (much more impressive) php pages to develop a way to update the basic information about all of my characters and thought I'd share in case anyone else was sick of updating their records by hand.

I decided to use perl because it is the language I script in, but unlike other computer languages that I am familiar with, I never took any kind of class, I am entirely arbitrarily self taught based on what I think I might want to do and google. It is entirely possible, nay likely, that this script is 3 times as long as it needs to be. This is one of my first times using subroutines, for example.


This script uses perl (I use strawberry perl) and the LWP library (for parsing and retrieving web content).



Below you will find a link to a zip file that contains the perl script itself, the csv file where you type your characters (I've included ten of mine, so you can get a feel for how it works) and a copy of the example output.


Notes on use: To use just change the names of the characters in the MyCharacters.csv file to your own. If you are in the EU you need to change the $usoreu variable to say "eu". The Account column is for your own use, it is not used in the query, so feel free to use actual account names/numbers or however you think of them (I just think of them as accounts 1-5, although 1 and 2 actually have names from being pre-bnet accounts and 3-5 are numbers like 71920901#1. I know some people prefer accounts A-E). For servers with a space in the name either Server-Name or Server Name seem to work just fine.


Example Input:
Name:  Image 142.png
Views: 275
Size:  85.3 KB



Example Output:
Name:  Image 139.png
Views: 264
Size:  96.4 KB


Files: let me know if this link doesn't work for you

PS. If you know how to make this blog show the full sized files please let me know! Sorry for the blur.

Updated 05-01-2016 at 08:33 PM by luxlunae

Tags: perl Add / Edit Tags
Categories
Uncategorized

Comments

  1. JackBurton's Avatar
    thats friggn magic
  2. JackBurton's Avatar
    I actually prefer making notes on spreadsheets over notepad because of the order and color you can put in there. most of my brainstorming is done this way.
  3. roxide's Avatar
    I'm having some issues in getting the info of my chars, I use alot of special ALT characters in my characters names would that be causing my problem getting the info I want? also where do I put LWP? like Apocalÿpse from Kil'jaeden
  4. luxlunae's Avatar
    It looks like it works but you take the apostraphe you out of Kiljaeden

    (I made that line of the CSV) Apocalÿpse,from,Kiljaeden

    the LWP folder is in this folder for me:

    D:\Programs\strawberry\perl\vendor\lib\
  5. schilm's Avatar
    Just stumbled across this, but the link to the file is broken... I've been using an excel spreadsheet that screen scrapes the Battlenet website for this, using the API seems somewhat easier. Could you relink the spreadsheet, please?

    Thanks!