Currently changing user_agent by passing different strings to the html_session()
method.
Is there also a way to change your IP address on a timer when scraping a website?
Currently changing user_agent by passing different strings to the html_session()
method.
Is there also a way to change your IP address on a timer when scraping a website?
You can use a proxy (which changes your ip) via use_proxy
as follows:
html_session("you-url", use_proxy("proxy-ip", port))
For more details see: ?httr::use_proxy
To check if it is working you can do the following:
require(httr)
content(GET("https://ifconfig.co/json"), "parsed")
content(GET("https://ifconfig.co/json", use_proxy("138.201.63.123", 31288)), "parsed")
The first call will return your IP. The second call should return 138.201.63.123
as ip.
This Proxy was taken from http://proxylist.hidemyass.com/ - no garantees for anything...
use_proxy("socks://127.0.0.1", 9050)
–
Favata html_session("https://www.maxmodels.pl", use_proxy("95.171.198.206", 8080))
generated the error Error in curl::curl_fetch_memory(url, handle = handle) : Timeout was reached: Connection timed out after 10000 milliseconds
–
Mailer © 2022 - 2024 — McMap. All rights reserved.