how to collecting Twitter data from past year

Hai friend,, anyone can help me, i'm really need a Twitter data from 2014, but when i use this coding

var1 <- search_tweets("tweet", n=999, since ="2014-01-01", until = "2014-01-31")

the result is 0 obs. of 0 variabel.. is it RStudio can't to collecting data from this past year because it is too old, or maybe i have a wrong syntax ??
how do i can to collecting data Twitter from 2014?? please, i need a help.

thankyou before :slight_smile:

1 Like

With the standard (free) search API, you can't get tweets for more than a one-week period. See Twitter API docs here:

Keep in mind that the search index has a 7-day limit. In other words, no tweets will be found for a date older than one week.

They have premium APIs that allow for other types of historical search, but I don't know much about the products themselves.

More info on their "historical API" products here:

2 Likes

Not sure if this will help: you can get older data than 7 days by searching a particular timeline.

tweets <- get_timelines("hadleywickham", 
                        n = 10000, 
                        language = 'en',
                        since = '2014-01-01', 
                        until = '2014-12-31',
                        token = twitter_token)

Will return 1,629 tweets.

I am assuming using rtweet library and having the twitter_token stored in an environment variable.

1 Like

Yeah, the restrictions I'm pointing to are exclusively for the search API. (Twitter also recently moved around all their dev docs, which is just an extra layer of annoying. :stuck_out_tongue_closed_eyes:)

1 Like

Yup, but the original post by @suryahariyadi had an air of desperation to it (almost like a school assignment with a deadline approaching fast). I wanted to give him some hope, even though the window for search API is hopelessly shut.

2 Likes

Oh totally, I just wanted to clarify since the fact that different APIs have different restrictions might be non-obvious. I think we're on the same page :+1:!

1 Like

Hi, Jindra,

if I understand your reply correctly, this means that I could get all of my tweets from the last n years in a single search, right?

I would expect to. The code quoted above returns 1,629 of Hadley's tweets from 2014 (which was the year OP was interested in). I am not certain whether it is the complete list, but it is a number in line with my expectations.

To be certain you would have to try :slight_smile:

1 Like

Thankyou friend with your answer.
Yeah i'm doing a kind of project in my college.. i'm doing sentiment analysis. Really really thankyou, but now i'm focus on the analisis cause i got little bit deppresed with the dataset

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.