Tôi đang thực hiện việc cào web bằng cách sử dụng trình quản trị web selenium bằng Python với Proxy.Trình Duyệt Web Selenium/Beautifulsoup + Lỗi Web + Lỗi 416
Tôi muốn duyệt qua hơn 10 nghìn trang của một trang web bằng cách sử dụng thao tác cạo này.
Vấn đề đang sử dụng proxy này Tôi có thể gửi yêu cầu chỉ một lần. khi tôi gửi một yêu cầu khác trên cùng một liên kết hoặc liên kết khác của trang web này, tôi nhận được lỗi 416 (loại IP chặn sử dụng tường lửa) trong 1-2 giờ.
Lưu ý: Tôi có thể xóa tất cả các trang web thông thường bằng mã này, nhưng trang web này có loại bảo mật ngăn tôi cạo.
Đây là mã.
profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference(
"network.proxy.http", "74.73.148.42")
profile.set_preference("network.proxy.http_port", 3128)
profile.update_preferences()
browser = webdriver.Firefox(firefox_profile=profile)
browser.get('http://www.example.com/')
time.sleep(5)
element = browser.find_elements_by_css_selector(
'.well-sm:not(.mbn) .row .col-md-4 ul .fs-small a')
for ele in element:
print ele.get_attribute('href')
browser.quit()
Bất kỳ giải pháp nào ??