Last active
October 2, 2021 01:25
-
-
Save fangzhou-xie/d73f7d79c9c6f570cca6465fb4a0f078 to your computer and use it in GitHub Desktop.
Tor in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set fresh_connect to force not using old connection (so that ip address could refresh per 10secs) | |
# depends on how you set up the refresh ip for Tor service | |
h <- curl::new_handle(proxy = "socks5://localhost:9050", maxage_conn = 10) # , fresh_connect = 1) | |
curl::handle_setheaders(h, "Cache-Control" = "no-cache", "User-Agent" = Randomuseragent::random_useragent()) | |
req <- curl::curl_fetch_memory("https://icanhazip.com/", handle = h) | |
rawToChar(req$content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment