The script (Figure 5) itself is quite basic as it just runs curl queries for a specific task to get the data int variables and then represent them. By 10:54 AM the same day, I quickly pieced together a bash script and posted it on pastebin then hopped onto Twitter again and posted this message with the link: “WolframAlpha bash API Scraper / used to get timespan for crypto challenge 20101008 -> “. The lesson here was to always RTFM (Figure 3) – the answers are there (literally) □Īfter running a few successful tests at 10:22 AM on September 24, 2010, I hopped on to Twitter and posted this message to the world “MuhAhaha Wolfram I have you now!” as I had struggled far longer than I had intended with getting fantastic results (while working on other projects including a public crypto challenge). I also was REALLY surprised that the default documented appid=xxxxx literally accepted the value of xxxxx (five letter Xs) to be interpreted as a valid AppID and proceed with the query, other values such as 12345, VWXYZ, BEBAD, 1ABCD, were not. It wasn’t clear what AppID was but I was quite surprised when I saw the results come back as expected and I could easily parse out the data I needed. Moving quickly, I used curl to mimic this procedure. In the documentation they gave sample information on how to access the API thusly: In my research, I found mention of their API version 1 and quickly snapped up the documentation. I had explored this avenue for a while, but it also took time go through on a case by case basis for something I wanted to whip up quickly. I had been using WolframAlpha’s web interface for quite some time and noticed they prevented scraping of this data by using javascript/css trickery. For a lot of my calculations I was using the commonly known ‘bc – An arbitrary precision calculator language’ but to write something with parameters it takes quite a bit of work to account for return values with large numbers. I first stumbled upon WolframAlpha’s API while looking for ways to extract data to get better results from bash on my Mac OS X system. (Figure 2) Then the question comes as to why someone would want to go through a sign-up process to test something a few times or even a few hundred thousand times if they didn’t have to? However, in my research, I have found that this is certainly not the case. Logic would dictate that due to this limitation developers would keep their AppIDs secret (read as: unavailable from the public eye) especially if their AppIDs were not of the free variety. Using the free development account with an assigned AppID the user can access up to 2,000 non-commercial API calls per month – if more are needed, pricing plans are available. WolframAlpha requires users sign up for a development account to get an AppID by signing up for a Wolfram ID so they may access their WolframAlpha API. To use the API one must have a valid AppID… (read that again)… a VALID AppID. For specific needs, there is also an API that users may use to execute queries and return results that then can further be processed programmatically. By default, the interface to do all these wonderful calculations is available via the web using a popular browser. Interestingly, most users aren’t aware of how to use this engine to its full potential. ![]() Wolfram|Alpha: Computational Knowledge Engine (WolframAlpha for short) is a fantastic (if not, simply THE BEST) tool for calculating arbitrary information using various forms of syntax. Now combine the search power of Google with the computational power of WolframAlpha and the results are limitless! It’s raining data from these saturated clouds, and you just need to hold out your hands for a taste. The all-seeing eye of Google has no mercy, and once the secret has been seen, indexed, and copied to clone sites, it is no longer a secret. Sharing source code with peers is one thing sharing secrets over a public medium is another.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |