Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub ExtractCode()
- SetProgressVisible(True)
- 'UI
- SetStatusText("Load the web page")
- ShowBusy("Extracting the source code...")
- Dim htmlpage As String = NormalizeCode(GetHTMLCode2(urlSourceCdoe))
- 'Look for code
- If htmlpage = String.Empty Then
- 'No code --Error
- SetStatusText("Can't load the page")
- SetProgressVisible(False)
- ShowMessage(Color.Red, "Can't reach the server")
- Else
- Dim Opener As String = "<div id=""code_frame"">"
- If htmlpage.Contains(Opener) Then
- SetStatusText("Source code founded")
- Dim Closer = "<div class=""content_title"">"
- Dim StartIndex As Integer = htmlpage.IndexOf(Opener)
- Dim EndiIndex As Integer = htmlpage.IndexOf(Closer, StartIndex)
- 'Get the code source
- ' Dim source = htmlpage.Substring(StartIndex, EndiIndex - StartIndex).Trim
- 'Calculate CSS and Html
- 'Return Value
- SetStatusText("Code extracted")
- ResultCode = htmlpage.Substring(StartIndex, EndiIndex - StartIndex).Trim
- Else
- SetStatusText("Can't find the source code")
- ShowMessage(Color.Red, "Can't extract the source code")
- End If
- End If
- SetProgressVisible(False)
- End Sub
Add Comment
Please, Sign In to add comment