2
你能幫我從twitter獲取數據嗎?研究了很多不能解決這個問題。從twitter獲取數據在r
library(twitteR)
library(ROAuth)
library(RCurl)
library(pacman)
library(devtools)
library(rjson)
library(httr)
consumerKey="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
consumerSecret="xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
access_token <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
access_secret <- "Xxxxxxxxxxxxxxxxxxxxxxxxxxx"
if (!require('pacman')) install.packages('pacman')
pacman::p_load(twitteR, ROAuth, RCurl)
options(RCurlOptions = list(cainfo = system.file('CurlSSL', 'cacert.pem', package = 'RCurl')))
reqURL = 'https://api.twitter.com/oauth/request_token'
accessURL = 'https://api.twitter.com/oauth/access_token'
authURL = 'https://api.twitter.com/oauth/authorize'
twitCred = OAuthFactory$new(consumerKey = consumerKey, consumerSecret = consumerSecret, requestURL = reqURL, accessURL = accessURL, authURL = authURL)
twitCred$handshake(cainfo = system.file('CurlSSL', 'cacert.pem', package = 'RCurl'))
它指引我授權和代碼,然後按I鍵進入
下一步
setup_twitter_oauth(access_token,access_secret)
我得到這個錯誤。如何解決這個問題。
[1] 「使用基於瀏覽器的認證」
Error in init_oauth1.0(self$endpoint, self$app, permission =self$params$permission, : Unauthorized (HTTP 401)
我已經安裝了應用程序已經發布,但我認爲我能夠生成一些推文。謝謝!! – Ashish