看板 R_Language 關於我們 聯絡資訊
[問題類型]: 請把以下不需要的部份刪除 程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來) [軟體熟悉度]: 入門(寫過其他程式,只是對語法不熟悉) [問題敘述]: 大家好 我開始使用TwitteR 做Text Mining, 目前就是自己註冊了Twitter 建立了一個App 然後跟著網路上的步驟連結R與自己的App 就可以用指令搜尋需要的Tweet 然而 初學者總是會遇到一些系統問題 我使用的是 Mac 10.13.6 我是在 # Saving and using certification to connect to Twitter # Asing for access 這裡的時候 R會direct我到一個authorize的頁面 但我一按下Authorize (這是我的Twitter App的Authorize頁面) 就顯示: 127.0.0.1 refused to connect. 於是我就開始搜尋可能原因 以下先放上我的code 以及stackoverflow上面有人貼的command 我的mkdir: /private/var/log/apache2: File exists sudo apachectl configtest Syntax OK 並沒有出現error message 不知道有沒有也是mac使用者版友有類似經驗的 願意分享一下? 謝謝大家! [程式範例]: ## Install packages and set up working directory install.packages(c( "twitteR", "ROAuth", "RCurl" )) ## call the packages ## library(twitteR) library(ROAuth) library(RCurl) ## Getting a curl certification download.file(url = "http://curl.haxx.se/ca/cacert.pem", destfile = "cacert.pem") ## Setting the certification from Twitter # Set constant requestURL requestURL <- "https://api.twitter.com/oauth/request_token" # Set constant accessURL accessURL <- "https://api.twitter.com/oauth/access_token" # Set constant authURL authURL <- "https://api.twitter.com/oauth/authorize" # consumer key and consumer secret consumerKey <- XXXXXX consumerSecret <- OOOOOO # Create authorization object by calling function OAuthFactory twitCred <- OAuthFactory$new ( consumerKey = consumerKey, consumerSecret = consumerSecret, requestURL = requestURL, accessURL = accessURL, authURL = authURL) # Saving and using certification to connect to Twitter # Asing for access twitCred$handshake( cainfo = "cacert.pem") 這邊跳出 To enable the connection, please direct your web browser to: 我也順利進到頁面 但一點authorize就出現 This site can’t be reached 127.0.0.1 refused to connect. 有找到一個類似的苦主: https://stackoverflow.com/questions/39364290/why-would-apache-refuse- connection-to-localhost-127-0-0-1-on-osx [環境敘述]: R version 3.5.1 (2018-07-02) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS High Sierra 10.13.6 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/ vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib locale: [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RCurl_1.95-4.11 bitops_1.0-6 ROAuth_0.9.6 twitteR_1.1.9 loaded via a namespace (and not attached): [1] bit_1.1-14 httr_1.3.1 compiler_3.5.1 rjson_0.2.20 R6_2.2.2 DBI_1.0.0 tools_3.5.1 yaml_2.2.0 [9] bit64_0.9-7 digest_0.6.15 [關鍵字]: Twitter 選擇性,也許未來有用 -- -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 129.21.68.251 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1533077907.A.D05.html
Wush978: 有先嘗試更新相關的套件嗎? twitter可能有改自己oauth的 08/02 08:32
Wush978: 流程導致相關認證壞掉,也有可能是防火牆擋掉 08/02 08:32
AmigoSafin: 我關了防火牆 然後看了rtweet的相關說明(是否twitteR 08/03 12:11
AmigoSafin: 出問題我也忘了 但rtweet從github在下一次 然後用 08/03 12:12
AmigoSafin: create_token(app, key, secret)順利用browser認證了 08/03 12:12
AmigoSafin: 我之前一天就是一直在setup_twitter_oauth中鬼打牆 08/03 12:13
Wush978: 總之,這種牽涉到其他第三方網路服務的出錯,SOP就是先 08/03 15:32
Wush978: 更新看看套件,以及去套件的issue區看是不是已經有人回報 08/03 15:32
AmigoSafin: 原來有SOP ^0^ 謝謝~~!! 08/05 03:18