Сетевые потоки - часть 3
End Sub
Public Readonly
Property GetRank() As Integer
Get Return ScrapeAmazon()
End Get End Property
Private Function ScrapeAmazon() As Integer Try
Dim theURL As New URI(m_URL)
Dim theRequest As WebRequest
theRequest = WebRequest.Create(theURL)
Dim theResponse As WebResponse
theResponse = theRequest.GetResponse
DimaReaderAsNew
StreamReader(theResponse.GetResponseStream())
Dim theData As String
theData = aReader.ReadToEnd
Return Analyze(theData) Catch E As Exception
Console.WriteLine(E.StackTrace)
Console. ReadLine()
End Try
End Function
Private Function Analyze(ByVal theData As String) As Integer
Dim Location As Integer
Location = theData.IndexOf("<b>Amazon.com Sales Rank:</b>") + "<b>Amazon.com
Sales Rank:</b>".Length Dim temp As String
Do Until theData.Substring(Location.l) = "<" temp - temp
&theData.Substring(Location,l) Location += 1 Loop
Return CInt(temp)
End Function
End Class