Accessing Twitter historic data in near-past - twitter

Is it possible to access historic Twitter data?
I want to write a function that accesses tweets which match certain keywords, like the FilterStream in the Twitter streaming API, but can access tweets which have been created historically.

No it is not.
All you can do, is use search method to get recent matching tweets. (little amount if keywords are unpopular)
Or connect to streaming API and wait (in little while you will have historic tweets)

Related

Is there any methods to get the like list of a tweet?

I want to get the complete like list of a specific tweet, but the Twitter API only provided an API that can retrieve the 100 most recent users who liked the specific tweet. I also looked for Twitter crawlers on Github, but they all worked in a user-oriented manner, ie they can only get a list of liked tweets of a user, not a list of liking users of a specific tweet.
I also tried to crawl the list using selenium, but maybe due to my limited skill, it didn't work well. I don't want to spend a lot of time studying selenium and front-end knowledge just to accomplish a simple thing, so are there any open source codes or twitter APIs that can do this?
Yes. This has just been announced in the Twitter API v2.
Previously, you were limited to the 100 most recent Likes or Retweets with these endpoints. We heard your feedback that this was too limiting and have updated these endpoints to now return all results. To retrieve a complete list of Likes and Retweets, you can now use pagination.
Use the v2 Likes lookup endpoint: GET /2/tweets/:id/liking_users

How can I retrieve the N most popular tweets for a country using the Twitter API?

TL;DR: I want to be able to retrieve the N most popular tweets for any arbitrary country within the last X hours (up to 24 hours)
More detail
I want to show the details of the most popular tweets by geographic region (country) over the past few hours (adjustable up to 24 hours). How can I use the Twitter REST API to achieve this (v1.1 or v2)?
There are endpoints for querying tweets and filtering by popularity, but they require a search string (e.g. "NASA") and return the most popular tweets matching that search string. I am not interested in the contents of the tweets, I just want to know what is most popular.
I plan on using this functionality to show a world map (using Leaflet) to summarise the most popular tweets by country for the past day.
I am using Twit in NodeJS but not looking for answers specific to Node, rather how to leverage the capabilities of the API.
I am not aware of a way that this can be done directly through the API itself (V1 or V2). I also do not think that this is going to be a trivial task at all.
What I would suggest is using the search endpoint...
V1: Reference
V2: Reference Note that to use geolocation search parameters (see below) you'll need academic access.
... in conjunction with one of the geolocation search parameters. For example, you could pull some subset of tweets from within a country (you will not be able to download all tweets within a single country on any given day, not to mention all countries). After you get this data, you'll need to do some of your own data processing based on how you want to define "popular" (e.g. retweets, likes, etc.) and then go from there.
As I said earlier, this seems like a very large project and not something that can be solved simply with the Twitter API.

Is there any limit for fetching followers from twitter

Fetching the followers list of a user, but there might be some users that have millions of followers. So are we able to fetch all followers using twitter api.
Presently using users/lookUp api and followersId api to get data.
Yes, there's a limit, around 5k(not exact as Twitter says) for each request.
You can use Twitter 'cursoring' technique as described here https://dev.twitter.com/overview/api/cursoring
The Twitter REST API utilizes a technique called ‘cursoring’ to paginate large result sets. Cursoring separates results into pages (the size of which are defined by the count request parameter) and provides a means to move backwards and forwards through these pages.
Each cursor has previous/next_cursor and other stuff that you can use when sending request. Check out the example provided in official documentation.

Is there a 'filter:hashtags' in the Twitter Stream API?

I'd like to only retrieve tweets that contain any hashtag in the Twitter Stream API. In the Search API, this can be done using 'filter:hashtags'.
I am using the locations filter and would like to also get tweets that contain the '#' character. Currently I get all tweets and I'd like to filter out the ones that do not contain a '#'. The 'term=#' doesn't seem to work.
Found this stale thread on the twitter dev forums https://dev.twitter.com/discussions/18787.
At this point I'm assuming it can't be done through the Stream API.
No, there isn't such a feature in the Streaming API.
You can refer to the documentation for a complete list of the available request parameters.

Getting curated content using streaming API

I cam across one third party API which provides organized twitter data as per user request.
example
http://api.frrole.com/v1/curated-content?location=India&contenttype=link&category=sports&orderby=popularity&minrt=10&resultcount=100&apikey=4534sdg34343
It give top 100 tweets from india, which contains link in tweets and falling into sports category and having minimum rt count =10.
Can someone tell me how does this work? It gives json data as result. Does this result comes directly via twitter streaming APIs or third party's own data base?
Is there any way for streaming API to do this?
This is likely coming from their database. They are consuming the data from the Streaming API or another API and then applying their categorization to it, then giving you the ability to access it from an API.
Some of the criteria above you could get from the Streaming API such as the filter_level (to find top Tweets) but you wouldn't be able to get that whole set of requirements (especially the sports categorization).

Resources