-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.R
43 lines (29 loc) · 1003 Bytes
/
script.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
library(rtweet)
library(dplyr)
## whatever name you assigned to your created app
appname <- "Call of Data"
## api key (example below is not a real key)
key <- "KQX5LLrBPvR3Cz30bcUvnehOW"
## api secret (example below is not a real key)
secret <- "Vv4D6EQTpVKoODCcwd5csmcVgtqrxR4GIXR5og7xQnNODphzdP"
## create token named "twitter_token"
twitter_token <- create_token(
app = appname,
consumer_key = key,
consumer_secret = secret)
## Read old tweets and append new
old <- readr::read_rds("hashtag.rds")
## Search for hashtags CallOfData2018, CoD18
hashtags_options <- c("CallOfData2018", "CallOfData", "CallOfData18", "T3FCallOfData")
tweets <- search_tweets2(
hashtags_options, n = 18000, include_rts = FALSE
)
tweets <- tweets %>%
select_(.dots = colnames(old))
all <- rbind(old, tweets) %>% unique()
readr::write_rds(all, "hashtag.rds")
all %>% distinct(status_id)
# from_us <- get_timeline(
# "RLadiesMAD", n = 18000
# )
# readr::write_rds(from_us, "rladiesmad_20180128.rds")