Fetch location or coordinates specfic posts using facebook search api - facebook

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.

Related

Query for pages of a specific type on Facebook

I need to have something like http://fanpagelist.com/category/musicians/ in my web app.
Basically I need to allow users to search through Facebook pages of musician/band category and sort by number of fans.
The closest I got was with this FB Graph API call:
search?q=musician&type=page&limit=25&after=MjQZD&fields=name,fan_count,category
But that is searching for pages that have 'musician' in the name, not in the category field.
Any idea? It must be possible since fanpagelist can do it...
There is no way to filter the results from that search endpoint directly.
You are limited to the options described under https://developers.facebook.com/docs/graph-api/using-graph-api/#search, and that basically means you can search by name, but nothing else.
So you will need to filter the results on your end.

How to get all user's likes using facebook's graph API

How can I query facebook's graph API to retrieve all user's likes (not only pages but also photos and others)?
For instance, how could I get all the pictures a user has liked? Using facebook's search bar you can find them easily by clicking on "photos has liked".
I wrote a script that scrapes the page content and does that but it's not very efficient.
I have recently come accross a similar problem, maybe this helps you solve it.
https://graph.facebook.com/v2.5/{page_id}/feed?fields=likes.limit(1).summary(true)&since={start_date}&until={end_date}&access_token={access_token}
This will give you a list of all posts that received likes during the specified time period. If you manage to write a code summing up the following JSON path you got your sum for "all user's likes":
data[0].likes.summary.total_count
Not entirely sure is this is exactly what you were searching for, hope it helps you though - and if not you, someone else.
As for likes you can also use the same way to extract Shares and Comments:
Shares
https://graph.facebook.com/v2.5/{page_id}/feed?fields=shares&since={start_date}&until={end_date}&access_token=
Comments
https://graph.facebook.com/v2.5/{page_id}/feed?fields=comments.limit(1).summary(true)&since={start_date}&until={end_date}&access_token=
Best regards
There isn't to my knowledge any way to get this from the API without grabbing every type of response from the API and then sorting through for likes. Facebook search bar uses an internal API different from the Graph API.

Facebook search form a term with geolocation

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.

facebook fanpage geotaggig map

Is there a way to have a map on my facebook fanpage with geotaggs from my photos similar with instagram map ??
I have a lots of pictures and i”ve put on everyone location so it would be nice to find a way to display my route on a map.
10x
I'm not going to provide full code for you to do this, but if you are prepared to put a little bit of code together, this should be pretty simple:
Get a list of photos from your Page. You can do this via Graph API with either the /pageid/photos or /pageid/tagged/ connections. You will of course require an access token in order to request this information.
This will give you a list of Photo IDs, so you should now iterate through these IDs one by one (or using Batch Graph API requests) and request the Graph API object for each Photo ID. In each object will be a place field (if the location has been tagged, and if the user whose access token you are using is able to view the photo) which contains a Place ID.
For each of those Place IDs, there may be (some Places lack this) a location field which will contain a latitude and a longitude.
Use these Geo-points with an API for Google, Bing or some other mapping software to create an HTML page with a map filled with markers that highlight each of the photos.
Use this HTML page as your Page Tab URL for a Facebook app and then follow these instructions to add this as a tab to your Facebook Page.
Done.

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