Facebook URL Graph Search - Page Queries - facebook

I am looking to generate a list of URLS or FB ID's for a set of existing Facebook Pages. Ultimately the initial query I am looking to run is simple: Find all NEW facebook pages created in City XYZ.
The term NEW, is open to interpretation. It could mean "Created this month" Or newer relative others in a set (these details are not important at the moment) . Also, "Pages" refers to fan pages (not user profiles).
I have identified 3 possible approaches. Both of which I am hoping to get some input on. Regarding feasibility and process.
Option 1) Somehow leverage Facebook's Graph API and develop some time of web application to generate a list of all Pages, then filter by city, then filter by date created.
Option 2 (Best Case)) Write or generate a custom Graph Search URL with embedded search criteria and leverage FBs existing search feature to get results. A great example of this approach is used by the tool searchisback.com. Only this tool is used to do advanced searches on People, but I need advanced searches on Pages.
Option 3) Locate a tool that already does this that I can use.
I again hoping to get some input and possible some direction/recommendations.
I should also mention that I actually know very little about Facebook APIs and Facebook Development. My position right now is of some who knows what they want to do, but no idea how to do it.

Option 1: Not possible, you can only search for Pages by name, the Graph Search is not available with the API. Those are all the options: https://developers.facebook.com/docs/graph-api/using-graph-api#search
Option 2: See answer to option 1.
Option 3: There are tools that list Pages, but they all have to add them manually. So there is not really a tool that does what you want to achieve.
In short: What you want to do is not possible.

Related

How to search Facebook's "invitable_friends" results

I have a Facebook app, and I'd like to allow my users to invite their Facebook friends to my app. The proper endpoint is /me/invitable_friends which is working well. But towards the bottom of that doc page, they recommend implementing a "search box" to filter the results, yet they don't offer any example of how to do this. I've searched around and haven't found anything.
It doesn't appear as though you can pass additional params for filtering the results. Obviously I can filter the results after the fact, but that's not scalable since the API only returns ~20 users at a time. That limit is modifiable (I believe), though it's of course not wise to bump it too high.
So how can I build a search box interface if I can't pass the search text to the endpoint? I must be missing something.
Thanks in advance.
PS - I'm using the JS SDK.
You should probably file a bug.
Based on the documentation the default size is 1000 records (average Facebook friend list size is 300-400)
If you don't see the next parameter at the end of the result under paging then there are no more results.

Google Analytics API, filter by parameter

Our app uses the Google Analytics Rest API. We'd like to get the number of page views generated by different links to the site.
For example, one link to our site might be:
http://oursite.com?linknum=12345
and another might be:
http://oursite.com?linknum=23456
We'd like to track the number of page views by all visitors who click on each link, so we need a way to filter by parameter.
So far, we just get the number of page views for all visitors without any filters:
curl 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga:(our id) &metrics=ga:pageviews&start-date=2014-4-26&end-date=2011-12-08&access_token=(our access token)'
The best way to learn the API is to use the query explorer at
http://ga-dev-tools.appspot.com/explorer/
For your analysis, add dimension=ga:pagePath and sort=ga:pageviews.
In addition, you could ask for pages which match a filter expression.
For example filter=ga:pagePath=#linknum to only include pages with linknum.

Is there any way to link Facebook Graph data with other data sources (Freebase, DBPedia)?

I have a set of Interest and Likes data from Facebook that I'm interested in enriching with data from other sources, namely Freebase. Is there some way to identify which entry within Freebase cooresponds to a given entry within the Facebook Graph?
Firstly, Facebook Graph does not offer any links to external sources, so it seems any sort of relationship needs to be found within the external source. I've found that, at least for some entries, Freebase offers a 'Facebook URL' and thus in a roundabout way you can link the two. For example for the band 'Taking Back Sunday', here is the Facebook Graph URL:
https://graph.facebook.com/23854511408
... which alternatively can use the vanity URL:
https://graph.facebook.com/TakingBackSunday
now in Freebase if I view the Taking Back Sunday entry in RDF format (http://rdf.freebase.com/rdf/en.taking_back_sunday) or JSON format I can see a link to the Facebook vanity URL. Assuming this attribute is queryable by MQL then linking Freebase to Facebook Graph via this method is possible. However the problem is that many entries in Freebase do not have a link to Facebook.
Any ideas on if there's a consistent way to discover these connections?
Create a spreadsheet out of your list of Interests and Likes with a column for the name and FB graph URI.
Load the spreadsheet into Google Refine.
Reconcile the name column with Freebase.
Create a new column for the Freebase URI based on your reconciled name column using the following GREL code:
"http://rdf.freebase.com/ns/" + cell.recon.match.id[1,-1].replace("/", ".")
Export your augmented data to a new spreadsheet.
If you can get the Facebook graph data into RDF format and if you're interested in connecting particular kinds of entities (e.g., bands) across the datasets, then you can use a link discovery tool like Silk. You write a mapping that tells Silk how to compares the name, genre, hometown etc., and Silk will calculate the connections. This requires quite a bit of effort though.
Another option might be to use Google Refine, which has a “reconciliation” feature that can discover Freebase entities that match your data. The challenge is again how to get the Facebook data into Google Refine.

Facebook Graph API SEO Comments and Profanity Filter

I'm trying to integrate the Facebook comments left on our site in a way in which the content can be crawled by search engines and also for people (although I highly doubt there will be many) who don't have Javascript enabled on their browser.
Currently our Facebook comments are displayed via the use of the Facebook comment social plugin (using the <fb:comments href="MY_URL" num_posts="50" width="665"></fb:comments> tag). This ends up rendering an iFrame (which are mostly ignored by search engine crawlers) so the plan is to render this information and format it with basic HTML. To do this, the comments are pulled using the Graph API - this is then only be displayed to crawlers and people with Javascript disabled.
This all works nicely using the Graph API call (https://graph.facebook.com/comments/?ids=MY_URL), parsing the JSON result and displaying it on the page. The problem is that the <fb:comments> approach filters our results based on a blacklist we have set up on one of our Facebook Apps. The AppId with the relevant blacklist is stored on the page using metadata (<meta property="fb:app_id" content="APP_ID"/>) which the <fb:comments> control obviously must somehow use to filter the comments.
The problem is the Graph API method does not filter any results as I guess no blacklist (or App Id containing a blacklist) is specified. Does anyone know how to specify a Facebook App ID to the API call URL or of another way to not fetch commnents back that violate the terms of the blacklist?
On a side note, I know the debate about filtering content in comments rages on but it is a management decision to implement the blacklist, and one that I have no influence in changing - just incase anyone felt the need to explain the reasons why content filtering is or isn't a good idea!
Any thoughts on a solution?
Unfortunately there's no way to access a filtered list of comments using the API - it might be a reasonably request to have this in the API - you should file a wishlist item in Facebook's bug tracker
Otherwise, the only solution I can think of is to implement your own filter on your side when retrieving and displaying the comments from the API.
According to the Comments plugin documentation the filter on Facebook's side is implemented as a simple substring match, so it should be trivial to implement.
A fairly simple regular expression match should be able to check each comment against a relatively long list quickly.
(Unfortunately, the tradeoff here is that implementing a filter is easy, but you'd also need to write an interface so that whoever's updating the list of disallowed words can maintain the list for both the Facebook plugin, and your own filtering.)
Quote from docs:
The comment is checked via substring matching. This means if you blacklist the
word 'at', if the comment contains the sequence 'a' 't' anywhere it will be
marked with limited visibility; e.g. if the comment contained the words 'bat',
'hat', 'attend', etc it would be caught.
Pretty sure there is no current way of doing this from the graph API, the only thing I can suggest is taking the blacklist and build your own filter

Facebook actions like spotify?

I'm trying to understand actions and objects on facebook and im completely blown away by how spotify publishes actions with that format. How the heck do you customize the layout of a user's action like that?
As far as im concern, with facebook's lovely documentation, all you can do is publish actions on a single line : (user A) -- (action) -- on -- (object) followed by a title and description.
How do you design html/css layout of a user's actions? Link? Attachment? I'm guessing you have to do some sort of "magic" on the description? Thanks!
Facebook's open Graph Tutorial does a decent job of explaining this but with the various options you have to scroll for a while to make it to the grouping part. In short, the individual actions you're familiar with combine together via "aggregations" which can be set to show a number of formats from lists to grids.
To set one of these up you must configure your Actions and Objects via the open graph settings first and then manually create an aggregation and a few defaults to fill in for preview purposes.
This will show up when a user authenticates your app for open graph and becomes customized to them as they start actually using said actions.
Now as for the play button option, that's something I assume is unique to their integration.
Documents at https://developers.facebook.com/docs/beta/opengraph/tutorial/