Projected Features:
Given an input of the item you currently have, and quanitity, upon startup the program will grab the latest GE prices, and calculate your profit from time of purchase (if known, and within 180days)
Calculate graph curve, and attempt rough prediction of item value fluctuation
Update grand exchange list (remotely hosted itemdb, or locally built, which at this moment in time is data usage heavy)
Slide away interface
Item search combining wikia listing & current GE Price data in result
Open source, implement via webserver or as a local program
At this stage, the grand exchange item crawling feature is 100% working (needs revising, but scans reasonably well), and you'll find that at the end of the thread!
For some of you out there who may enjoy programming, the projects current code would be great for indexing the GE, as apparently the item numbers change from time to time, and being able to reliably check a range of indexes for change could be very useful.
To compile yourself:
-Listview Control (3 columns, itemindex itemname itemurl)
- 2 x TextBox (1 & 2) - textbox1 is starting index, textbox2 is final index
Reference to mshtml.dll (7.5)
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Imports mshtml
Public Class itemdbcrawler
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim itemindex As Integer = CInt(TextBox2.Text)
Dim itemcount As Integer = CInt(TextBox1.Text)
Dim baseurl As String = "http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj="
Dim countedurl As String
While itemcount < itemindex
countedurl = baseurl & itemcount.ToString
Dim request As WebRequest = _
WebRequest.Create(countedurl)
request.Credentials = CredentialCache.DefaultCredentials
Dim response As WebResponse = request.GetResponse()
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
Dim dataStream As Stream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Dim doc As IHTMLDocument2 = New HTMLDocumentClass()
doc.write(New Object() {responseFromServer})
doc.close()
reader.Close()
response.Close()
Dim ContentStr As String = metacapture(doc)
If Not ContentStr.Contains("role-playing") Then
Dim fields() As String
fields = Split(ContentStr, ",")
Dim Index As String = itemcount.ToString
Dim Name As String = fields(1)
Dim Url As String = countedurl.ToString
ListViewAddItem(Index, Name, Url)
End If
itemcount += 1
End While
MessageBox.Show("Crawl Complete")
End Sub
Private Function metacapture(ByVal htmldoc As IHTMLDocument) As String
If (htmldoc IsNot Nothing) Then
Dim Elems As IHTMLElementCollection
Dim Errors As IHTMLElementCollection
Dim WebOC As IHTMLDocument = htmldoc
Errors = WebOC.getElementsByTagName("div")
For Each elem As IHTMLElement In Errors
Dim NameStr As String = elem.getAttribute("id")
If ((NameStr IsNot Nothing) And (NameStr.Length <> 0)) Then
If NameStr.ToLower().Equals("errorcontent") Then
Return "0"
Else
Elems = WebOC.getElementsByTagName("meta")
For Each elem2 As IHTMLElement In Elems
Dim NameStr2 As String = elem2.getAttribute("name")
If ((NameStr2 IsNot Nothing) And (NameStr2.Length <> 0)) Then
If NameStr2.ToLower().Equals("keywords") Then
Dim ContentStr As String = elem2.getAttribute("content")
Dim returnstring As String
Dim fields() As String
fields = Split(ContentStr, ",")
returnstring = (WebOC.url.ToString() & "," & fields(3))
Return returnstring
End If
End If
Next
End If
End If
Next
End If
End Function
Private Delegate Sub ListViewAddItem_delegate(ByVal i_index As String, ByVal i_name As String, ByVal i_url As String)
Private Sub ListViewAddItem(ByVal i_index As String, ByVal i_name As String, ByVal i_url As String)
Dim myArgs(2) As Object
myArgs(0) = i_index
myArgs(1) = i_name
myArgs(2) = i_url
If Me.ListView1.InvokeRequired Then
Dim d As New ListViewAddItem_delegate(AddressOf ListViewAddItem)
Me.ListView1.BeginInvoke(d, myArgs)
Else
Dim lvi As New ListViewItem(i_index)
lvi.SubItems.Add(i_name)
lvi.SubItems.Add(i_url)
ListView1.Items.AddRange(New ListViewItem() {lvi})
ListView1.Update()
End If
End Sub
End Class




Smexy Sarah












