Github Search Api with Pagination? - ios

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

Related

YT search API to search for Arabic speaking channels locally in Israel

How can I retrieve all Arabic speaking channels locally in Israel.
Using the API explorer, I don't see such an option.
Which fields are mandatory for search to call the search API?
Is there any way to fulfill this task?
Update:
API Explorer
I couldn't get results
There are lots of parameters in the API v3 Docs for Search that you can play around with, some in particular you might find helpful are:
location
locationRadius
regionCode
relevanceLanguage
and you'll need to set type = "channel" to return only channels.
The only mandatory parameter is part which is what data you want returned from your results. For this search call, you only have one option for part, which is "snippet".
This is the only way to do it simply within your multiple parameters, and it will take 100 quota per search, assuming you have an API key already.
If you press 'Try This API' on the right, it'll even give you code snippets you can copy in a variety of languages, since you didn't specify one in the prompt.
Depending on the language, a call could look like the following:
GET https://youtube.googleapis.com/youtube/v3/search?part=snippet&location=Israel&regionCode=IL&relevanceLanguage=ar&type=channel&key=[YOUR_API_KEY] HTTP/1.1

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.

twitter api 1.1 url count alternative

I've been using the old url api(v1) to get the count of a given url, lately I needed to get also the re-tweets and started searching about that.
this is the exact url I'm using right now:
http://urls.api.twitter.com/1/urls/count.json?url=http://google.com
As I viewed with some reading the v1 api is deprecated but at least it's still working.
I found some questions on the dev page of twitter:
https://dev.twitter.com/discussions/12643
those are a little old questions and have no specific solving to the problem. I mean, the most near solution was using the search api(search/tweets) which could be good but not a exactly replacement for the urls/count method.
Please note that Twitter's search service and, by extension, the
Search API is not meant to be an exhaustive source of Tweets. Not all
Tweets will be indexed or made available via the search interface.
also it has a limit for 100 results at maximum per 'page', even it throws the link to get the next set of objects, thats good but when the search reaches 1 million of results I'll need to get page over page to now how much tweets I got and having to do to much request to the api...
I sought some question over the dev page on twitter suggested using the stream api, I've tried using (statuses/filter) but that don't work very well given a URL as track param(which they said that is the keyword to track).
So, anyone who's been using the old urls/count has found a reliable alternative with the new apiv1.1, especiffically to get the tweets and re-tweets for a given url ?
The official suggestion by Twitter staff is that either the search/tweets endpoint (having just the last 7 days data) or the Streaming API be used (handling yourself the counters, making everything just too complicated for a d*mn counter).
As an extra warning, the old endpoint (http://urls.api.twitter.com/1/urls/count.json?url=YOUR_URL) will stop working on November 20th, and according to this blog post from Twitter there are no plans to replace it with anything in the short term and they are even removing the count from their own buttons.

Displaying tweets from multiple users (similar to Embedded Timelines) without twitter-side user lists

I am new to Twitter and need some tips.
I need to display tweet feed from multiple users on some webpage.
The first thing I stumbled upon is Embedded Timelines. It allows to display tweets from list of users but the gotcha is that those lists should be maintained on Twitter-side (i.e. I cannot specify #qwe and #asd only on my side and get timeline without adding those users into list on Twitter-side).
The thing is that list of users that should be included into timeline is dynamic and managing those lists through Twitter API will probably be painful. Not to mention that my website will probably generate tons of those lists and I feel that I will violate some api quotas sooner or later.
So, my question is - am I stuck with using Embedded Timelines that refer some user list on Twitter-side and managing those lists through, say Twitter REST api, or there is a simplier way to do what I want?
It's pretty simple to display tweets for multiple users.
Links to start with
This post explains some of the search queries you can make
This post is a simple library to make requests to the twitter API that 'just works'
Your Query
Okay, so you want multiple users. The endpoint you're looking at using is the search/tweets one: https://api.twitter.com/1.1/search/tweets.json.
The query string uses :from and you can interpolate multiple froms with AND/OR.
An example query for the GET request:
?q=from:user1+OR+from:user2
Read more about the search API queries here.
Your "over-the-quote" issue
This is something you're going to need to figure out yourself - depending on the number of requests you expect to make, and the twitter imposed limits, maybe some sort of caching or saving information when you hit your limit, and only pull back from the cache whilst you're hitting your limit..

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