Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function GetBetween(ByRef strSource As String, ByRef strStart As String, ByRef strEnd As String, _
- Optional ByRef startPos As Integer = 0) As String
- Dim iPos As Integer, iEnd As Integer, lenStart As Integer = strStart.Length
- Dim strResult As String
- strResult = String.Empty
- iPos = strSource.IndexOf(strStart, startPos)
- iEnd = strSource.IndexOf(strEnd, iPos + lenStart)
- If iPos <> -1 AndAlso iEnd <> -1 Then
- strResult = strSource.Substring(iPos + lenStart, iEnd - (iPos + lenStart))
- End If
- Return strResult
- End Function
- Private Sub ScrapeBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ScrapeBtn.Click
- Dim WebHandle As New System.Net.WebClient
- Dim WebString As String = WebHandle.DownloadString(String.Format("http://boards.4chan.org/b/res/0"))
- Dim WebSplit() As String = WebString.Split("target=")
- Dim ImageCount As Integer = 0
- Dim Filter As String = Nothing
- For Each i As String In WebSplit
- If i.Contains("images.4chan.org") = True Then
- Dim Build_O As String = CStr(GetBetween(i, "//images", """")).Trim
- Dim ID As String = CStr(GetBetween(i, "/src/", "."))
- If Filter = ID = False Then
- Filter = ID
- ImageLinks.Items.Add("http://images" & Build_O.Trim)
- ImageCount += 1
- End If
- End If
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment