no api secrets in source code, fixing deletion of ssh pfadiskn tweets also for 2015

master
mxmehl 8 years ago
parent b85be742d4
commit 655746bece

@ -34,14 +34,14 @@ row.names(acc_df) <- NULL
# --> devtools::install_github("joyofdata/RTwitterAPI")
# https://dev.twitter.com/rest/reference/get/statuses/user_timeline
api_params <- c(
"oauth_consumer_key" = "c9Ob2fWNSONMC0mA2JlNaeRke",
"oauth_consumer_key" = readLines("twitter-api-credentials.txt")[2],
"oauth_nonce" = NA,
"oauth_signature_method" = "HMAC-SHA1",
"oauth_timestamp" = NA,
"oauth_token" = "1007025684-RFxCDFc4OPkt02bASmdci00TB4jgaPjfqxLRT58",
"oauth_token" = readLines("twitter-api-credentials.txt")[4],
"oauth_version" = "1.0",
"consumer_secret" = "cZ3Il2hmbLgK0Lc57mj5kUvymjVdsmZKYwKOGHR3NhCpvWgEOI",
"oauth_token_secret" = "rvfv8MgexFKTqrPNSoGrdrZVNhV4fTJb2Bgz249nbvKNg"
"consumer_secret" = readLines("twitter-api-credentials.txt")[3],
"oauth_token_secret" = readLines("twitter-api-credentials.txt")[5]
)
#api_url2 <- "https://api.twitter.com/1.1/statuses/show.json"
@ -186,7 +186,7 @@ for(a in 1:nrow(acc_df)) {
# Every tweet from 2014 or newer from user[a] is downloaded. Now next user in for-loop
}
rm(a, code, current, error, loop, max_id, name, query, r, status, user, wait, tweets_full, tweets_temp)
rm(a, code, current, error, loop, max_id, max_count, year_first, year_last, name, query, status, user, wait, tweets_full, tweets_temp)
# CLEAR DATAFRAME ---------------------------------------------------------
@ -196,7 +196,6 @@ save(tweets_complete, file="tweets_complete.RData")
# Remove duplicates
tweets <- tweets_complete[!duplicated(tweets_complete), ]
tweets <- na.omit(tweets)
save(tweets, file="tweets.RData")
rm(tweets_complete)
# Format dates in data frame
@ -205,15 +204,14 @@ Sys.setlocale("LC_TIME", "C")
tweets$created_at <- as.POSIXct(tweets$created_at, format = "%a %b %d %H:%M:%S %z %Y")
tweets <- tweets[order(tweets$created_at), ]
# Finally delete every tweet not from 2014 (so also )
# Finally delete every tweet not from 2014 (2013 or 2015)
delrow <- NULL
pb <- txtProgressBar(min = 0, max = nrow(tweets), style = 3)
for(r in 1:nrow(tweets)) {
if(format(tweets$created_at[r], "%Y") != "2014") {
delrow <- c(delrow, r)
}
if(format(tweets$created_at[r], "%Y") == "2014") {
break
}
setTxtProgressBar(pb, r)
}
tweets <- tweets[-delrow, ]
rm(delrow, r)
@ -221,3 +219,6 @@ rm(delrow, r)
# Convert dates to omit (unnecessary) time
tweets$created_at <- format(tweets$created_at, "%Y-%m-%d")
save(tweets, file="tweets.RData")

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1 +0,0 @@
c9Ob2fWNSONMC0mA2JlNaeRke

@ -1 +0,0 @@
cZ3Il2hmbLgK0Lc57mj5kUvymjVdsmZKYwKOGHR3NhCpvWgEOI

@ -0,0 +1,5 @@
# 1. line: consumer key, 2. consumer secret, 3. oauth token, 4. oauth secret
c9Ob2fWNSONMC0mA2JlNaeRke
cZ3Il2hmbLgK0Lc57mj5kUvymjVdsmZKYwKOGHR3NhCpvWgEOI
1007025684-RFxCDFc4OPkt02bASmdci00TB4jgaPjfqxLRT58
rvfv8MgexFKTqrPNSoGrdrZVNhV4fTJb2Bgz249nbvKNg
Loading…
Cancel
Save