Facebook search form a term with geolocation - facebook

Facebook has the Keyword Insights API that solves this question, but it's not available for all developers - except for some partners and we have this example:
SELECT location_results FROM keyword_insights WHERE term='Obama' AND country='US'
From https://developers.facebook.com/docs/keyword_insights/#examples
But without have access to Keyword Insights API is it possible search for user posts that have the term "Obama" in coordinates 39.781762,-89.649854 with a radius of 50 miles?
Thanks in advance.

No. It's not possible to get insights from the user posts without an access to the Keyword API.
An alternate can be to use the Facebook Graph API Search. It allows you to narrow your search to a specific location and distance. For example, you can specify the latitude and longitude using the center parameter in the query:
https://graph.facebook.com/search?q=obama&type=posts&center=37.76,-122.427
&distance=1000&access_token=<token>
You can parse the result obtained from it and generate insights on your own.

Related

Facebook Graph API: search people by city

I'm trying to find people either from particular city or who live in that city. Is there an API for this purpose?
When I use Facebook page, I can type in "People who live in Rome, Italy" (which is translated to URL https://www.facebook.com/search/115353315143936/residents/present) and it shows me all people who currently live in Rome. Using web page I can also search people by name and then add additional filter by city.
Can I do something similar with Graph API?
You can only search by name with the API: https://developers.facebook.com/docs/graph-api/using-graph-api#search - there is no way to get the same kind of search than on facebook.com.
you can add center and distance in the query
this comes from the documentation, you can change the type to type=user
GET graph.facebook.com
/search?
q=coffee&
type=place&
center=37.76,-122.427&
distance=1000

How can i get all users in a specific location in Facebook Graph API?

I am trying to get all Facebook users centered around 12.9667° N, 77.5667°E.
How can I do this?
I have tried the following query. But the Center and distance parameter don't seem to be working .
https://graph.facebook.com/search?q=mark&type=user&center=12.9667,77.5667&distance=1000
I still get Mark Zuckerberg in the results, even though he is no where close to the specified Lat-Long.
Where am I going wrong?
The center and distance field don't apply to the user object because the current_location field is not publicly available through the API. So, they are just ignored.
user_location or friends_location permissions to view:
current_location
Source: https://developers.facebook.com/docs/reference/fql/user/

Fetch location or coordinates specfic posts using facebook search api

Is there are way to fetch location/coordinate specific public posts using the facebook search api (https://graph.facebook.com/search/?q=KEYWORD&type=post ...)? I want this to be a general search query, without any user authorization.
I tried using https://graph.facebook.com/search?type=location&center=37.76,-122.427&distance=1000&access_token=... , but this requires access_token and returns objects(not posts) posted only by friends of the user whose access token is used for querying.
I also tried https://graph.facebook.com/search?q=samsung&type=post&center=12.9833,77.5833&distance=1000&access_token=[I-USED-ANY-ACCESS-TOKEN], but I dont think this is giving me the location specific results as I am not receiving any loc info in the json response.
Are there any free data sources/APIs that can provide me location/coordinate/ip specific posts/data/tweets/feeds, etc from the web / social networking websites?
It is possible to walk the FB graph to get such places and their coordinates for types like event, place, checkin. For example:
Search (link):
https://developers.facebook.com/tools/explorer?method=GET&path=search%3Fq%3Dconference%26type%3Devent
Then pick one of the results and do (link):
https://developers.facebook.com/tools/explorer?method=GET&path=463944956965055
Then lookup the venue id's coordinates (link):
https://developers.facebook.com/tools/explorer?method=GET&path=199344279273
Check the FQL table definitions to verify that location coordinates are provided.
The accepted answer doesn't really answer the question.
The answer is no, there isn't a way to search for general posts by location (excluding your friends). It's probably to protect user privacy.

Query Facebook to collect info on all birthdays in an area

First time poster so please be gentle. I'm looking for a way to run a FQL query that will return all of the birthdays for a given geographical area. For example: Return all of the (publicly-shared or access-token available) birthdays for everybody that lives within 50 miles of Portland, OR.
I've dinked around with FQL with simple queries, but once I hit the multi-query stuff it gets messier. Facebook's developer page gives an example of running the query in PHP, but I just want to figure out the proper URI variables and do it by hand in a browser window.
I assume you're asking about the current / app user's friends?
If so you're probably better to just pull all friends' birthdays, and current locations, and where the friend has a location specified, do your own matching - the API won't let you query users by current location

Find related facebook interests using graph API

I'm trying to figure out a way find related interests on Facebook. E.g. I want to search for Cityville and result should be Farmville, Castleville etc.
Is there an API to support this, what are the alternatives?
You can search the JSON result by the Graph API with the url https://graph.facebook.com/me/likes?access_token={your_token_here}, replacing the "me" with the Facebook User ID/Name.
If you are looking for pages search, you can use the same API, with the url https://graph.facebook.com/search?q={keyword}&type=page&access_token={your_token_here}.