How to get social media links from Google Knowledge - facebook

Currently I'm working on a project that require me to collect celebrities followers number (from instagram or facebook).
To get that number, i have to get
1. celebrities instagram link
2. celebrities facebook link
3. send a request to instagram or facebook API to get their followers number
I have been researching for google knowledge API for celebrities instagram and facebook link. but what I get from it isn't satisfying.
For example, I put a request on google Knowledge,
https://kgsearch.googleapis.com/v1/entities:search?query=Ariana+Grande&limit=1&indent=1&key={API-CODE}
and the result is
{"#context": {
"#vocab": "schema.org/",
"goog": "schema.googleapis.com/",
"EntitySearchResult": "goog:EntitySearchResult",
"detailedDescription": "goog:detailedDescription",
"resultScore": "goog:resultScore",
"kg": "g.co/kg"
},
"#type": "ItemList",
"itemListElement": [
{
"#type": "EntitySearchResult",
"result": {
"#id": "kg:/m/09gkdy4",
"name": "Ariana Grande",
"#type": [
"Thing",
"Person"
],
"description": "Singer",
"image": {
"contentUrl": "t0.gstatic.com/images?q=tbn:ANd9GcS3KH3ae6ChLCPLguyQXbLbEXDTNMZ1Sb2LsMx6Vr-pjeuHg5AZ",
"url": "da.wikipedia.org/wiki/Ariana_Grande",
"license": "creativecommons.org/licenses/by/2.0"
},
"detailedDescription": {
"articleBody": "Ariana Grande-Butera, known professionally as Ariana Grande, is an American singer and actress. She began her career in the Broadway musical 13, before landing the role of Cat Valentine on the Nickelodeon television series Victorious in 2009. ",
"url": "en.wikipedia.org/wiki/Ariana_Grande",
"license": "en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"
},
"url": "www.arianagrande.com"
},
"resultScore": 802.862244
}
]
}
There's no information regarding her instagram or facebook link from the result, but if we search manually on google, it shows her instagram and facebook link on search result.
My question are:
1. Any way to get those link from Google knowledge?
2. Or any easier way to get follower number from celebrities beside my way? (jugling from 2-3 different APIs)
Thanks.
I really appreciate any comment and help.

You can use wikidata.org. There are steps:
Search https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Ariana+Grande&language=en&format=json
{"searchinfo":{"search":"Ariana Grande"},"search":[{"id":"Q151892","concepturi":"http://www.wikidata.org/entity/Q151892","url":"//www.wikidata.org/wiki/Q151892","title":"Q151892","pageid":153289,"label":"Ariana Grande","description":"American actress, singer, composer and dancer","match":{"type":"label","language":"en","text":"Ariana Grande"}}],"success":1}
Get id Q151892 from the response and get the entity https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q151892&format=json&props=claims
There is a big response. You need the value arianagrande of claim P2003 from a list of claims. It refers to Instagram username (P2013 for Facebook)
Get public info from https://www.instagram.com/arianagrande/?__a=1
user:
follows:
count
followed_by:
count
media:
count

Related

Can't get categories on Likes on new FB graph API (2.5)

I am using this URL to access facebook likes off of an authorized and logged in user:
https://graph.facebook.com/v2.3/me/likes?access_token=accessToken
it returns this
"data": [
{
"name": "Page Name",
"category": "Category name",
"id": "12345678",
"created_time": "2012-03-26T08:02:01+0000"
},
However on my new app which uses API 2.5
https://graph.facebook.com/v2.5/me/likes?access_token=accessToken
it returns this
"data": [
{
"name": "Page Name",
"id": "12345678",
"created_time": "2012-03-26T08:02:01+0000"
},
Which is minus the category name.
I have my new app registered in FB and it will not allow me change API from 2.5, and even on my new app if I use the 2.3 URL it will still not display categories.
Does anyone know what extra calls I need to make to get categories or why they have disapeared in newer versions of the API, I can't find anything on google or on FB's doco's
It´s called "Declarative Fields", check out the changelog for v2.4: https://developers.facebook.com/docs/apps/changelog#v2_4
That´s what you need to change:
/me/likes?fields=name,category&access_token=accessToken

Can I aggregate Facebook Likes, Tweets, and Google Pluses?

I'm building a voting application on my new website, cabinethardware.org. I'd like the voting to be done in such a way that when someone votes for a project (to receive a $1000 rebuilding grant) that they are encouraged to plug the project via social networks. My programmer has had difficulty with the application, and it occurred to me that one way of doing it is to just put like, tweet and G+ buttons on the site and add them together. So if a project gets 24 likes, 12 tweets, and 18 G+, it would have 64 votes. It doesn't bother me if someone votes on all three engines.
Before a project is eligible for a grant, it must receive 100 votes. My question is, is there a way that I can aggregate the likes, tweets, and G+ so that I can see on the backend how many votes each project has, without going to each project and adding them up by hand? Also, I'd like to display to customers the combined total.
Does anyone know of a way to combine the count of these three?
For Google+, you would only need to perform one API call to the Google+ APIs that would be searching the Google+ public data. Searching the Google+ public data is demonstrated in the API explorer.
The post response contains information about reshares and +1s:
"verb": "post",
"object": {
"objectType": "note",
"content": "Setting up a server-side flow project that accesses Google+ data using the .NET stack can be a little tricky, I walk you through it in this blog post.",
"url": "https://plus.google.com/109716647623830091721/posts/g8LjdGAXdDc",
"replies": {
"totalItems": 0,
"selfLink": "https://www.googleapis.com/plus/v1/activities/z125srm50lf1slxrd04cfftatqyoglnoqio/comments"
},
"plusoners": {
"totalItems": 6,
"selfLink": "https://www.googleapis.com/plus/v1/activities/z125srm50lf1slxrd04cfftatqyoglnoqio/people/plusoners"
},
"resharers": {
"totalItems": 0,
"selfLink": "https://www.googleapis.com/plus/v1/activities/z125srm50lf1slxrd04cfftatqyoglnoqio/people/resharers"
},
For Facebook, you can use the Pages API to count likes for your page, you can experiment with this in their API explorer.
The following data shows their response data:
{
"about": "Build and distribute amazing social apps on Facebook. https://developers.facebook.com/ ",
"company_overview": "Facebook Platform enables anyone to build social apps on Facebook, mobile, and the web.\n\n",
"is_published": true,
"talking_about_count": 39241,
"username": "FacebookDevelopers",
"website": "http://developers.facebook.com",
"were_here_count": 0,
"category": "Product/service",
"id": "19292868552",
"name": "Facebook Developers",
"link": "https://www.facebook.com/FacebookDevelopers",
"likes": 952596,
"cover": {
"cover_id": "10151121467948553",
"source": "https://fbcdn-sphotos-f-a.akamaihd.net/hphotos-ak-ash4/s720x720/299374_10151121467948553_45631061_n.png",
"offset_y": 0
}
}
Likes are just a member in the response data.
For twitter, you can query for mentions of a user with their search API and passing a search string for the user as #user. A count of the objects within results is going to be your mention count. The response data is a little too much to paste in here but here's an example query using their API.

Facebook – Does a page exist for this URL?

I'm making a webpage/SEO checking page, where I can put in a URL and it will tell me various facts about the page.
I'd like to be able to tell if there is a Facebook page associated with the URL. Is this possible using the API, or by other means?
For instance, https://www.facebook.com/focalstrategy links to http://www.focalstrategy.com/ on the info tab – is there a way to go the other way and enter the URL and find the page(s)?
(Bonus points – anyone know of a way to do the same for Twitter accounts)
I don't think this is possible. Using the API, you can retrieve info about the url:
http://graph.facebook.com/?id=http://www.focalstrategy.com/
Would return:
{
"id": "http://www.focalstrategy.com/",
"shares": 38
}
Now I'm note sure if using the Open Graph Meta Tags would help return more data (still not what you need), but here is my website info without trailing slash:
http://graph.facebook.com/?id=http://www.masteringapi.com
Would return:
{
"id": "109784969102047",
"name": "MasteringAPI.com",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/276619_109784969102047_474156823_s.jpg",
"link": "http://www.masteringapi.com/",
"likes": 25,
"category": "Website",
"website": "http://www.masteringapi.com",
"description": "Master Facebook, Google and Twitter APIs! Learn Facebook Application Development Now!",
"can_post": true
}

Scope of Facebook API

I am trying to learn and create a Facebook API on the go. However, I haven't found any page on the developer pages that specifies the scope of the Facebook API in great detail. I understand public information can be accessed using Graph API. But at the same time understand that further access is possible, not sure how much though.
Is there anyway to access the 'Edit news feed options' of a user that authorizes an application?
I don't really understand what you mean by "scope", but the Graph API is not more than a series of URLs to contact the facebook servers with queries and obtain answers in form of JSON objects.
You can start learning by looking at the reference for the API here:
http://developers.facebook.com/docs/reference/api/
There are unofficial APIs for every language you can imagine, for example java: http://code.google.com/p/facebook-java-api/ , c#: http://facebooksdk.codeplex.com/ , etc.
To read the news feed, you can access it by:
https://graph.facebook.com/me/home?access_token=TOKEN (where TOKEN is the access token)
Fb will respond with a JSON object similar to the one pasted below.
{
"data": [
{
"id": "11111_1111111111,
"from": {
"name": "Name",
"id": "11111111"
},
"message": "SOME_MESSAGE",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/111111/posts/11111"
},
{
"name": "Like",
"link": "http://www.facebook.com/11111/posts/11111"
}
],
"type": "status",
"created_time": "2011-04-20T20:19:04+0000",
"updated_time": "2011-04-20T20:19:04+0000"
},
etc etc etc
],
"paging": {
"previous": "https://graph.facebook.com/me/home?access_token=TOKEN",
"next": "https://graph.facebook.com/me/home?access_token=TOKEN"
}
}
Having that, you can use the ID for the person or the message to perform new queries, as explained in the FB API page:
All of the objects in the Facebook
social graph are connected to each
other via relationships. Bret Taylor
is a fan of the Coca-Cola page, and
Bret Taylor and Arjun Banker are
friends. We call those relationships
connections in our API. You can
examine the connections between
objects using the URL structure
https://graph.facebook.com/ID/CONNECTION_TYPE.
The connections supported for people
and pages include:
Almost every information on FB is accessible through the Graph API, provided the user authorized the app with the rigth permissions:
http://developers.facebook.com/docs/authentication/permissions/

How to access Facebook Fan Page Photos within external Website

We are trying to utilize the facebook photo hosting and allow our visitors to view photos via our webpage that have been uploaded to our fan wall.
Does anyone know how this can be achieved?
Thank in advance!
Steven.
Using the social graph, you can do this, provided the script has an access token for your facebook page app ID or your photo permissions are set to be completely public.
Using the social graph, you basically access the photos via a REST like web service. The webservice call will return a JSON object of dataExample:
https://graph.facebook.com/cocacola/albums
(Photo albums for the Coca Cola fan page)
So the first step would be to retrieve the albums using a URL like the one above.
Traverse through the photo albums and get the object ID of the album you want.
{
"id": "455377148305",
"from": {
"name": "Coca-Cola",
"category": "Company",
"id": "40796308305"
},
"name": "Coca-Cola Fanmeile FIFA WM 2010",
"link": "http://www.facebook.com/album.php?aid=249745&id=40796308305",
"count": 20,
"type": "normal",
"created_time": "2010-10-22T15:53:36+0000",
"updated_time": "2010-10-22T15:55:23+0000",
"comments": {}
},
Once you have the object ID, you can access it by simply placing it as the first paramter of the graph URL. E.g:
https://graph.facebook.com/40796308305
From there, you should be able to grab the actual URL to the images (depending on permission settings)
{
"id": "40796308305",
"name": "Coca-Cola",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs236.ash2/50516_40796308305_7651_s.jpg",
"link": "http://www.facebook.com/coca-cola",
"category": "Company",
"website": "http://www.coca-cola.com",
"username": "coca-cola",
"products": "Coca-Cola is the most popular and biggest-selling soft drink in history, as well as the best-known product in the world.\n\nCreated in Atlanta, Georgia, by Dr. John S. Pemberton, Coca-Cola was first offered as a fountain beverage by mixing Coca-Cola syrup with carbonated water. Coca-Cola was introduced in 1886, patented in 1887, registered as a trademark in 1893 and by 1895 it was being sold in every state and territory in the United States. In 1899, The Coca-Cola Company began franchised bottling operations in the United States.\n\nCoca-Cola might owe its origins to the United States, but its popularity has made it truly universal. Today, you can find Coca-Cola in virtually every part of the world.",
"likes": 22264613
}