Código:
Dim temp As String
Dim buscar As String
Dim paquete As String
Dim pagina As Long
Dim DataTemp As String
Private Sub Command1_Click()
buscarGoogle (Text2.Text)
End Sub
Public Function buscarGoogle(data As String)
ws.Close
ws.Connect "www.google.es", 80
Label1.Caption = "Conectando..."
buscar = data
End Function
Private Sub Form_Load()
End Sub
Private Sub List1_Click()
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
On Error Resume Next
If Text2 = "" Then Exit Sub
If KeyAscii = "13" Then
buscarGoogle (Text2.Text)
End If
End Sub
Private Sub ws_Connect()
Label1.Caption = "Conectado"
buscar = Replace(buscar, Chr(32), "%20")
ws.SendData "GET /search?q=" & buscar & paquete & " HTTP/1.0" & vbCrLf & _
"Accept: */*" & vbCrLf & _
"User-Agent: Buscador(By WarGhost)" & vbCrLf & _
"Host: www.google.es" & vbCrLf & vbCrLf
End Sub
Private Sub ws_DataArrival(ByVal bytesTotal As Long)
Dim data As String
ws.GetData data
temp = temp & data
Label1.Caption = "Buscando"
If Not InStr(1, temp, "</html>") = 0 Then
DataTemp = Mid(temp, InStr(1, temp, "<html>"))
Label1.Caption = "Busqueda Terminada"
Dim dat As String
dat = Mid(DataTemp, InStr(1, DataTemp, "<a class=l href=""") + 17)
While Not InStr(1, dat, "<a class=l href=""") = 0
List1.AddItem Mid(dat, 1, InStr(1, dat, """>") - 1)
Label2.Caption = List1.ListCount
dat = Mid(dat, InStr(1, dat, """>") + 2)
dat = Mid(dat, InStr(1, dat, "<a class=l href=""") + 17)
Wend
List1.AddItem Mid(dat, 1, InStr(1, dat, """>") - 1)
Label2.Caption = List1.ListCount
pagina = pagina + 10
If pagina = 110 Then
Exit Sub
End If
paquete = "&hl=es&lr=&start=" & pagina & "&sa=N"
temp = ""
buscarGoogle (buscar)
End If
End Sub
este código lo que hace es cojer el resultado de la búsqueda de las 10 primeras paginas y quedaría así:
yo creo que para hacer un spider email esto seria bastante útil.
Salu2