How to use Tor socks5 in R getURL

前端 未结 4 1227
终归单人心
终归单人心 2021-02-06 09:45

I want to use Tor in getURL function in R. Tor is working (checked in firefox), socks5 at port 9050. But when I set this in R, I get the f

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 10:15

    Under Mac OSX install Tor Bundle for Mac and Privoxy and then update the proxy settings in the system preferences.

    'System preferences' --> 'Wi-FI' --> 'Advanced' --> 'Proxies' --> set 'Web Proxy (HTTP)' Web Proxy Server 127.0.0.1:8118

    'System preferences' --> 'Wi-FI' --> 'Advanced' --> 'Proxies' --> set 'Secure Web Proxy (HTTPS)' Secure Web Proxy Server 127.0.0.1:8118 --> 'OK' --> 'Apply'

    library(rcurl)
    curl <- getCurlHandle()
    curlSetOpt(proxy='127.0.0.1:9150',proxytype=5,curl=curl)
    html <- getURL(url='check.torproject.com',curl=curl)
    

提交回复
热议问题