我正在制作一个程序,通过使用返回所述用户信息的网站来检查用户的价值。我想在我的程序中使用一些信息。我希望阅读页面并修剪返回的字符串会起作用,但我所追求的信息不在那里。以下是我最近的尝试,它什么都不返回。
Dim pos1 As Long, pos2 As Long, strAccount As String
Dim request As WebRequest = WebRequest.Create("http://rbx.trade/s/" + TextBox2.Text)
Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
Dim datastream As Stream = response.GetResponseStream
Dim reader As New StreamReader(datastream)
Dim strData As String = reader.ReadToEnd
pos1 = InStr(strData, "rap")
pos1 = InStr(pos1 + 1, strData, "rap", vbTextCompare)
pos2 = InStr(pos1 + 1, strData, "rank", vbTextCompare)
strAccount = strData.Substring(pos1, pos2 - pos1)
textbox5.text = strAccount
我希望获得的观点:
我正在尝试将RAP值返回给此用户的textbox5,它是1,104 我一直在努力,并且无法想象我的生活。有人请帮忙。
答案 0 :(得分:0)
我喜欢做这样的事情......
'cold
pos1 = strdata.IndexOf("class=""rap"">") + "class=""rap"">".length
strdata = strdata.remove(0,pos1)
'warm
pos1 = strdata.IndexOf("hide-on-small-only"">") + "hide-on-samll-only"">".length
strdata = strdata.remove(0,pos1)
'hot
dim result as string = strdata.remove(strdata.indexof("<",0))