|
Bot Of The Month Club
How does StockQuoteBot work? Where does it get the stock quotes? StockQuoteBot starts by receiving a whispered query from a citizen. It takes that query and separates the stock symbol. Then, using HTTP ("The Web"), it submits a web page form query to quote.yahoo.com - pretending to be Internet Explorer. The URL submitted is: https://quote.yahoo.com/q?s=MSFT&d=v1&o=t. Normally, Yahoo returns a full page of information about a stock, in a table form. By specifying the d=v1 and o=t parameters, StockQuoteBot is asking Yahoo for a simplified web page, and in regular text, not a table. StockQuoteBot then reads the response from Yahoo. Remember, StockQuoteBot is pretending to be Internet Explorer, so Yahoo just sends back the URL request as a web page. StockQuoteBot searches all of the web page that was returned from Yahoo, and picks out the part that it's looking for - the stock price. If you look at the source code from the above web page, you will find that the price is BOLD (surrounded by <b> and </b>) - and that it's the only bold that is preceded by several spaces. StockQuoteBot knows what to look for on the web page, and it searches the response from Yahoo for anything that is in bold and preceded by a few spaces. StockQuoteBot also knows that once it has found the price quote, the end of the price quote is identified by the next '<' symbol. StockQuoteBot "screen-scrapes" the web page, gets the price quote, and then whispers the answer back to the citizen who asked. What else does StockQuoteBot do? Actually, StockQuoteBot is really WebFormBot, just renamed. WebFormBot is a generic bot that reads specifications for web pages (it can handle a bunch of different web pages all at the same time), and then queries citizens by way of whispers in AW to get the information to fill out a web 'form' (which may contain several input fields), and then submits the form, parses the reply, and displays the result to the citizen. The WebFormBot running in the HamGlaze world demonstrates other web page features. For example, try this bot out to send a text message to someone you know with a Sprint PCS cell phone:
Currently, WebFormBot handles Text and Hidden input fields. Future enhancements include processing of radio buttons, checkboxes, comboboxes, and multi-line text fields. Also, processing of abbreviated cellphone (HDML - Handheld Device Markup Language) and and Palm Pilot pages (web clipping) would be nice to do. If you have any questions, please contact HamFon .
|
Active Worlds | Newsletter Home | Newsletter Archive | Contact Us | Disclaimer |