How do you get the next page of twitter results using the Twitter OAuth API? - twitter

I am using the twitter oath API and I get the first page of results for my search query. But I want to get all pages, so how do I iterate using the API to get the next page?

Twitter has been removing support for pagination from their API, in favor of query params that specify search bounds. Here's the relevant snippet from their blog:
"All methods currently supporting cursoring or usage of since_id and max_id will remove support for "classic" pagination through the "page" parameters. See Working with Timelines for more information."
Source: https://dev.twitter.com/blog/api-housekeeping

Related

How to embed a Twitter Timeline filtered by a hash tag

I am trying to create a twitter timeline which includes tweets related to a specific hashtag.
Then I need to embed it to a website.
I tried https://tweetdeck.twitter.com/ but it informs me to go https://publish.twitter.com/
But it doesn't provide support to do the embed.
How can I proceed?
There's no support for embedded search timelines any more (as of July 2018). You'll need to build something that searches the API for the Tweets you want to include, and then use the oembed API to display the Tweets in your webpage.

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.

Github Search Api with Pagination?

I want to use the Github search API Restfully in my iOS application to query public repositories based on 'language' (programming language) as the primary parameter for the search.
From the API documentation i can understand that the following api gives me what i need.
https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc
Although, this returns 370 such repositories for the particular language.
I want to implement pagination in the iOS app so that i can fetch around 10-30 entires at a time only. I have seen that github provides pagination for some of their Api's.
However when i try the following api's with the 'page' and 'per_page' included in the parameter i still get the same results, not limited to the page or the per_page i want.
https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc&page=1&per_page=10
Does the github api provide pagination for this search api?
If so what am i missing? How do i go about using it?
The total_count is the total number of repositories, not the number of itens that are in the JSON.
The pagination is working as expected, try this and see the result, the number of itens in each request is 10 (as you set in the last parameter "per_page)
Do a crtl+f by full_name, it will be easier to see the number of itens per request
Check the result of this 2 requests.
https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc&page=1&per_page=10
https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc&page=2&per_page=10

how to find out when a link was first tweeted

http://isitold.com/ somehow determines when a link/url was first tweeted. I can't seem to figure out how to do this with the twitter api, does anybody know?
I'd like to use when a link was first tweeted in a time decay function in my app.
You can search tweets with this link using the Twitter Search API to retrieve the oldest tweet possible.
Seems like twitter does not provide historical tweets (search api will not work).
You can get access to historical tweet information with a service like Topsy http://www.topsy.com http://code.google.com/p/otterapi/ (api on topsy).
I have written Who Tweeted It First using YQL and JS to find the oldest tweet for any topic. It is essentially scraping data from the Twitter search page as the official API doesn't return the previous tweets.

why do i only see one tweet in the search from API Query?

I'm using the following query:
https://twitter.com/search.json?callback=?&q=from:_adeel&count=5&include_entities=true&include_rts=true
and I would like to see the last 5 tweets from this user. You can see that the user has many more than 2 tweets yet the query only returns 2 tweets. I'm following the twitter search API and I fail to see what I'm doing wrong. I prefer to use the twitter search API because I want to perform the search on the client side without authentication and rate limits.
Do you see what I am doing wrong?
As indicated here in the documentation, the search API is an index of recent tweets, between 6-9 days old. It looks like the other tweets from the user you linked to are just outside this window.
So to summarize - you are not doing anything wrong. This is simply a limitation of the Twitter API.

Resources