1
indeed.com을 긁어 내려고 실제로 빈 블록으로 동적 IP 용 Crawlera 서비스를 구입했습니다. 여기 VBA에서 crawlera 프록시 사용
가 곱슬 곱슬 명령 줄 도구 Crawlera을 사용하는 방법의 예입니다curl -U key: -x proxy.crawlera.com:8010 http://httpbin.org/ip
HTTPS 페이지를 다운로드하는 경우, 내가 인증서 파일을 사용해야합니다. 저는 VBA의 초보자이며 프록시 사용법을 모르겠습니다. VBA에서 정보를 가져 오기 위해이 프록시를 사용하여 요청을 만들고 싶습니다.
Dim ie As SHDocVw.InternetExplorer
Dim doc As IHTMLDocument
Dim SearchForm As HTMLFormElement
Dim WhatInputBox As HTMLInputElement
Dim WhereInputBox As HTMLInputElement
Dim SubmitButton As HTMLInputButtonElement
Dim HTMLelement As IHTMLElement
Dim oInputs As IHTMLElementCollection
Dim Listings As IHTMLElementCollection
Dim i As Long, j As Long, r As Long, lngRetVal As Long
Dim TotalResumes As Long, ResumesPerPage As Long, TotalPages As Long, PageNo As Long
Dim firstURL As String, nextURL As String
Set ie = New SHDocVw.InternetExplorer
ie.Visible = True
Set myIE = New SHDocVw.InternetExplorer
myIE.Visible = False
Dim StringFound As Boolean
StringFound = False
If Len(Trim(Range("D1").Text)) > 0 Then
StringFound = True
End If
If Len(Trim(Range("F1").Text)) > 0 Then
StringFound = True
If StringFound = True Then
Const cURL = "http://www.indeed.com/resumes?co="
End If
ie.Navigate cURL & Mid(ActiveSheet.Shapes("Country").ControlFormat.List(Range("J1").Value), InStr(1, ActiveSheet.Shapes("Country").ControlFormat.List(Range("J1").Value), "(", vbTextCompare) + 1, 2)
Application.StatusBar = "Going to the Website........."
If Right(Range("H1").Value, 1) = "\" Then
myFolderPath = Range("H1").Value
Else
myFolderPath = Range("H1").Value & "\"
End If
Do While ie.Busy
Loop
Application.StatusBar = "Going to the Website........."
Do
Loop Until ie.ReadyState = READYSTATE_COMPLETE '= 4
Sleep 5000
Dim ieElement As Object
Dim ieElement2 As Object
Set ieElement = ie.Document.getElementById("query")
ieElement.Value = Range("D1")
Set ieElement2 = ie.Document.getElementById("location")
ieElement2.Value = Range("F1")
ieElement.Document.getElementById("submit").Click
Do While ie.Busy
DoEvents
Loop
Application.StatusBar = "Searching for Resumes........."
Do
Loop Until ie.ReadyState = READYSTATE_COMPLETE '= 4
Sleep 5000
Range("A3:K1048576").ClearContents
Set doc = ie.Document
firstURL = doc.Url
If Len(doc.getElementById("result_count").innerHTML) = 0 Then
MsgBox " No results found " & vbCrLf & "Pls check the website", vbCritical
ie.Quit
Set ie = Nothing
myIE.Quit
Set myIE = Nothing
Application.StatusBar = ""
Exit Sub
End If
어떻게 요청을하기 위해 크롤러 프록시를 사용할 수 있습니까? 이 요청을하는 방법을 검색했지만 도움이 될만한 것을 찾을 수 없었습니다.
예,이 작동하지만 내 코드를 볼 경우 Internet Explorer를 사용하고 있습니다. 프록시 설정을 사용하고 크롤러가 제공하는 프록시가 작동하는지 확인하기 위해 Internet Explorer를 구성해야합니다. –