more api stuff
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
require(jsonlite)
|
||||
require(stringr)
|
||||
require(RCurl)
|
||||
require(httr)
|
||||
require(devtools)
|
||||
require(RTwitterAPI)
|
||||
|
||||
source("functions.R")
|
||||
|
||||
setwd("~/Dokumente/Uni/Aktuell/BA-Arbeit/R-Code")
|
||||
setwd("~/Dokumente/Uni/Aktuell/BA-Arbeit/uni-ba-issuecomp")
|
||||
|
||||
# Set curl handle for friendly scraping
|
||||
handle <- getCurlHandle(httpheader = list(from = "max.mehl@uni.kn",
|
||||
@@ -14,5 +15,27 @@ handle <- getCurlHandle(httpheader = list(from = "max.mehl@uni.kn",
|
||||
)
|
||||
|
||||
acc_url <- "http://www.bundestwitter.de/api/politiker"
|
||||
acc_json <- readLines("politiker.txt")
|
||||
acc_df <- fromJSON(acc_json)
|
||||
|
||||
df <- fromJSON(acc_url)
|
||||
# --------------
|
||||
|
||||
|
||||
# http://www.joyofdata.de/blog/twitters-rest-api-v1-1-with-r-for-linux-and-windows/
|
||||
# devtools::install_github("joyofdata/RTwitterAPI")
|
||||
|
||||
params <- c(
|
||||
"oauth_consumer_key" = "c9Ob2fWNSONMC0mA2JlNaeRke",
|
||||
"oauth_nonce" = NA,
|
||||
"oauth_signature_method" = "HMAC-SHA1",
|
||||
"oauth_timestamp" = NA,
|
||||
"oauth_token" = "1007025684-RFxCDFc4OPkt02bASmdci00TB4jgaPjfqxLRT58",
|
||||
"oauth_version" = "1.0",
|
||||
"consumer_secret" = "cZ3Il2hmbLgK0Lc57mj5kUvymjVdsmZKYwKOGHR3NhCpvWgEOI",
|
||||
"oauth_token_secret" = "rvfv8MgexFKTqrPNSoGrdrZVNhV4fTJb2Bgz249nbvKNg"
|
||||
);
|
||||
|
||||
url <- "https://api.twitter.com/1.1/statuses/user_timeline.json";
|
||||
query <- c(screen_name="peteraltmaier", exclude_replies="true", include_rts=1, count="1");
|
||||
|
||||
result <- fromJSON(twitter_api_call(url, query, params))
|
||||
|
||||
Reference in New Issue
Block a user