how to get facebook search results - facebook

I am trying to build a network of people that match a search criteria on FB and get their friends. All public information of course, or at least accessible to my own account. Say I search for the name "Smith".
I want to get all the people that match that query, then search in their connections all those names that match "Smith" and the relationship to each others and so on. This way I create clusters of the various interconnected "Smith"(es).
I am fluent with R and so I tried the Rfacebook package. There is a function there called searchFacebook but it does not work anymore, because the API search was disabled by Facebook itself. for info I get:
Searching for posts was deprecated with version 2.0 of the Facebook Graph API.
What options do I have in this case? Is this even possible?
The language is not an issue, I can use Python too. I just used R cause it's faster for me.
Thanks

Related

Search users in organization using Github Rest API

I am trying to search for users in a Github organization using the rest API.
I found the members list query that doesn't allow searching, and I found the user search query that apparently doesn't allow filtering by organization.
I basically want something in between these two queries but couldn't find it.
Is there another way to do it that I am missing?

How to get github users from city using Github REST API?

Background
I am working on an app and I need to get all the projects of all github users that live in a given city using the GitHub Rest API v3: https://developer.github.com/v3/
Research
Now I know I can get all the users with the following url:
https://api.github.com/users
And once I have a user, I can get all his repos and info from there.
Problem
The problem is that I don't know how to filter those users by city!
I have tried adding a paramter location=London but it always returns the same, probably because this is not the real parameter...
Another option would be to get all the github users from the world, and then filter them by city .... which would be totally insane.
The best option I found so far was to use this link:
https://github.com/search?q=language:javascript+location:Barcelona&type=Users
However, this link is the web version, which does not use the REST API.
Question
How do I get all the users from a given city using the Github REST API?
You are using the /users endpoint. You need to use the /search/users endpoint:
https://api.github.com/search/users?q=location%3Aiceland
Will search for users located in Iceland
Using that gets me a response with a bunch of users and after cross checking the first 3, they all have their location set to "Iceland" in their profiles.

How does the Facebook Graph API public post searching works?

I've started working with Facebook Graph API this month and I'm currently experiencing some odd behaviors with it.
To start, I'm using the Graph API 1.0 (which supports public post searching), with queries such as those below.
https://graph.facebook.com/v1.0/search?q=foo bar&type=post
https://graph.facebook.com/v1.0/search?q=foo&type=post
The weird behavior in this case is that the first query returns almost the same number of results that the second one. Thus, no matter how "vague" my query is, I'm getting a limited number of posts (yeah, I'm already considering pagination).
So how does this work? The Graph API Documentation isn't clear about this subject, so any clarification would be really appreciated.
As I understood so far, Facebook does not return all public posts containing the researched terms. Some old questions here in StackTrace support this assumption (example)
Different apps or different users may retrieve different results (which is another "odd" behavior I found). (example)
Am I correct? If so, is there ANY way to improve my recall? Any paid services from Facebook or specific permissions that I should get for my app? Searching from multiple views (users or apps) would help? Is there any way to query only recent results and therefore obtain more results?
Thank you.
P.S.: I'm aware that Facebook has been planning to remove this functionality by 2015, but for now it's working and I wanted to give a try :-)

Getting number of people who like a page on facebook by city

A question than has been floating around is how to get the list of IDs of people that like a page (here, or here, for instance). From previous answers (and reading the FB API docs...) I am convinced that to be impossible.
However, that is not what I'm after. I don't need the user_ids at all. I just need the number of likes of a page, per city (or some subdivision of a country). There is a field for a Page for the total number of likes, which obviously isn't enough. Insights should provide this, but while page_fans_country works ok as the info is public, page_fans_city returns no results, so I'd need a different way of getting the information.
Is there a query (or set of queries) that would work? Either Graph API or FQL would be fine, at this point.
As to your first statement, I have found that to be correct aswell. My current solution includes, as it has to, external storage.
On to your actual question, it is possible via the Insights API you've found yourself. Rather than moving on from page_fans_city (because it returns no results), you should find the issue. Most likely, you're using a User Access Token without the scope manage_pages, which prevents it from becoming a Page Access token. You should also include read_insights. Read more here. For further information about the object/insights go here.
Hope this helped.

Is there a GitHub API to get autocomplete suggestions for user/organization name?

I know how to get the list of organizations for a user.
However, I want to let the user type in the user/organization name and provide autocomplete for that name where the autocomplete includes all user/organizations, not just the organizations they belong to.
It would be too long to get the entire list (and I am not sure that GitHub even exposes that), but the top 5-20 for any given prefix is all I want.
The Search API smells more like a single transaction search and not an autocomplete API, so while I could use it, most likely it would hit the rate limit too often and give a bad UX.
There is something close to this with https://github.com/autocomplete/users?q=prefix, but that is not part of the official GitHub API, so I know that the back end does support these kind of queries... I am just not finding it from the API documentation, and I don't want to access a non-API URL.
GitHub does not do this for you and likely never will. One option you have is to construct a service like that yourself and constantly update your list of users. One way to update the list of users (sanely) is to do the following:
Make an initial GET to /users?per_page=100
Save the ETag header that's returned and use pagination to get all of the most recent ones
On future requests send along the ETag and when there are new users, save the newest ETag.
Repeat.
So you'll be able to then build an auto-completion service yourself so long as you keep your listing of GitHub users up-to-date.
Also note, that sending along the ETag will save your ratelimit if there is nothing new to return.