I used (in 2012) to code with FQL and I was able to make some features such as
FQL query to fetch all data of a facebook page
Actually, FB migrate to graph API.
My question is : Is it possible to retrieve public data of a page (or person) with graph API, even if I'm not a fan of that page (or not a friend )
Yes, everything that you want to do is quite possible with the Graph API. Unless the Page / Group is private, then you will be able to fetch their public data without having to like the page.
https://developers.facebook.com/docs/graph-api
A useful tool that Facebook has provided is the Graph Explorer that allows you to test your queries and see what information will come back: https://developers.facebook.com/tools/explorer
As a specific example that you can fetch without any auth tokens: http://graph.facebook.com/cineplex will return
{
"id": "11751844989",
"about": "Starring Galaxy, Cineplex Odeon, SilverCity, Famous Players, Colossus, Coliseum, Cinema City & Scotiabank Theatres.",
"can_post": false,
"category": "Movie",
"checkins": 0,
"cover": {
"cover_id": "10150491543319990",
"offset_x": 0,
"offset_y": 0,
"source": "https://scontent.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/s720x720/10377524_10150491543319990_3410282243848063213_n.png?oh=47c4eb7d50a4d259236ee7c2bbb3300a&oe=55C89C6E",
"id": "10150491543319990"
},
"description": "For showtimes and theatre locations check out www.cineplex.com.\n\nCineplex Entertainment is the largest motion picture exhibitor in Canada and owns, leases or has a joint-venture interest in 162 theatres with 1,639+ screens serving approximately 77 million guests annually. Headquartered in Toronto, Canada, Cineplex operates theatres across Canada and is the exclusive provider of UltraAVX\u2122 and the largest exhibitor of digital, 3D and IMAX projection technologies in the country. Proudly Canadian and with a workforce of approximately 10,000 employees. \n",
"directed_by": "Cineplex Entertainment",
"has_added_app": false,
"is_community_page": false,
"is_published": true,
"likes": 414426,
"link": "https://www.facebook.com/Cineplex",
"name": "Cineplex",
"parking": {
"lot": 0,
"street": 0,
"valet": 0
},
"phone": "1-800-333-0061",
"plot_outline": "ESCAPE WITH US",
"starring": "Cineplex Odeon, Galaxy, SilverCity, Scotiabank Theatres, Famous Players, Colossus, Coliseum and Cinema City",
"talking_about_count": 5147,
"username": "Cineplex",
"website": "www.cineplex.com",
"were_here_count": 0
}
Related
I am new to blockchain and i am trying to play with blockchain so I used metaplex and candy-machine to upload and mint dummy nft's which is working fine. The opensource repositories that I am playing with are below:
https://github.com/metaplex-foundation/metaplex
https://github.com/exiled-apes/candy-machine-mint
Then for learning purposes, I wanted to divide minting and secondary sales into more than one wallet so I changed JSON and added three test wallets into the creator's array.
{
"name": "#0",
"symbol": "%$%",
"description": "description goes here",
"seller_fee_basis_points": 500,
"image": "image.png",
"external_url": "",
"edition": 0,
"attributes": [
{
"trait_type": "Background",
"value": "Street"
}
],
"properties": {
"files": [
{
"uri": "image.png",
"type": "image/png"
}
],
"category": "image",
"creators": [
{
"address": "<public address 1>",
"share": 34
},
{
"address": "<public address 1>",
"share": 33
},
{
"address": "<public address 1>",
"share": 33
}
]
}
}
But the problem is splitting is happening on secondary sales and not on minting. On minting the wallet set as treasury resource is getting all amount. I want to split the transaction amount on minting too.
Interestingly, I found this quote in the metaplex documentation:
The SPL Metadata program supports storing up to five co-creators that
share potential future profits from sales for the items as defined by
seller_fee_basis_points . Each creator needs to be added as part of
the minting process and is required to approve metadata that was used
in his name using the sign_metadata endpoint. Unverified artwork
cannot be sold with Metaplex.
During the first sale, creators share in 100% of the proceeds, while
in follow up sales, they share in proceeds as a percentage determined
by seller_fee_basis_points. Whether or not a metadata is considered in
second sale or not is determined by the primary_sale_happened boolean
on the Metadata account.
My interpretation of this is that the expected behavior should be for the initial sale to get divided between creators using the ratios defined by each creator's share. Sounds like you're experiencing something different.
Keep in mind that this documentation is for the parent project. Candy-machine-mint seems to be a fork and they may have altered some of that behavior.
The source code of the code of the contract you are intersted in can be found here: https://github.com/metaplex-foundation/metaplex-program-library/blob/master/nft-candy-machine/program/src/lib.rs
At line 247 the transfer of sol is called to a single treasury address of the candy machine. To change it to multiple addresses this contract would have to be updated and redeployed.
Another alternative I have seen deployed in the solana community atm is a second contract which will split the funds evenly. Unfortunately, the creator of this contract has been charging for it and has not open-sourced it yet. They can be found on the metaplex discord if you are interested.
Articles from the blogging website get published on multiple Facebook pages and I need to get the list of facebook post urls that contain specific article url.
It is possible to get og_object details by article url using this request:
https://graph.facebook.com/v2.5/?id=http://spoilednyc.com/2015/02/10/16-bucket-list-must-dos-real-new-yorkers&access_token=ACCESS_TOKEN
The result will be:
"og_object": {
"id": "794284920664423",
"description": "New York City has so much to offer beyond the attractions most known to tourists. Want to go off the beaten path, here are some suggestions for you.",
"title": "Beyond the Tourist Attractions: 16 Bucket List Must-Dos for 'Real' New Yorkers",
"type": "article",
"updated_time": "2016-02-19T11:21:26+0000",
"url": "http://spoilednyc.com/2015/02/10/16-bucket-list-must-dos-real-new-yorkers/"
},
"share": {
"comment_count": 0,
"share_count": 15247
},
"id": "http://spoilednyc.com/2015/02/10/16-bucket-list-must-dos-real-new-yorkers"
}
From this point I can find, for example, a list of comments using
https://graph.facebook.com/v2.5/794284920664423/comments/?access_token=Access_Token
Is there a way to get Facebook posts or post-ids by og_object id in a similar way?
Is there a way in which I could get the Album Date of an Album as seen on Facebook?
Here is a sample screenshot of one of the albums that I would like the data to be retrieved.
Please check this album https://www.facebook.com/media/set/?set=a.470385546361350.110064.186460284753879&type=3
I want to specifically get the January 24 data.
I have used http://graph.facebook.com/470385546361350 but it only returns the create and update dates as shown below
{
"id": "470385546361350",
"from": {
"category": "Local business",
"name": "Philippine Business for the Environment",
"id": "186460284753879"
},
"name": "BFI, Letran, PBE Ink MOA for GHG Management Course",
"description": "Start them young. This was the intention of BPI Foundation Inc. (BFI), Colegio de San Juan de Letran, and the Philippine Business for the Environment (PBE) upon forging an agreement last January 22 in training select Letran college students on greenhouse gas (GHG) inventory and management. On hand were Mr. Florendo G. Maranan, Executive Director of BFI; Fr. Tamerlane R. Lana, OP, President of Letran; and Mr. Bonar A. Laureto, Executive Director of PBE. The program, known as \u201cBPI Greenhouse Gas Inventory and Management Program for University Students,\u201d is made available to 100 Letran college students who have the aptitude in understanding the relationship between environmental stewardship and good business praxis and who are willing to participate in future GHG inventory services. The students are also encouraged to donate one history book to Letran\u2019s partner public school, promoting the spirit of social justice and development. The syllabus and material for the five-day course, prepared by PBE, will make use of an Activity-Analysis-Abstraction-Application process. This will enable the students to gain technical and applied knowledge and skills on GHG inventory and management that are currently applied in various workplaces. At the end of the program, the students are expected to become active in GHG inventory and management and other environmental advocacies of Letran.",
"link": "https://www.facebook.com/album.php?fbid=470385546361350&id=186460284753879&aid=110064",
"cover_photo": "470385596361345",
"count": 3,
"type": "normal",
"created_time": "2013-02-05T08:00:04+0000",
"updated_time": "2013-02-06T04:36:38+0000",
"can_upload": false,
"likes": {
"data": [
{
"id": "100002097532966",
"name": "Krex Lopezbaliza"
}
],
"paging": {
"next": "http://graph.facebook.com/470385546361350/likes?limit=25&offset=25&__after_id=100002097532966"
}
}
}
I'm getting my page wall with the open graph.
And when someone posted a photo, I get it on the JSON
{
"id": "27888702146_10150369820322147",
"from": {
"name": "brocoli",
"category": "Record label",
"id": "27888702146"
},
"message": "Vincent Epplay / David Fenech / Jac Berrocal \u00e0 Beaubourg ce soir, 19h, gratos.",
"picture": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc7/305819_10150369820292147_27888702146_8255527_583491475_s.jpg",
"link": "https://www.facebook.com/photo.php?fbid=10150369820292147&set=a.386279807146.165840.27888702146&type=1",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"type": "photo",
"object_id": "10150369820292147",
"created_time": "2011-10-16T08:22:21+0000",
"updated_time": "2011-10-16T08:22:21+0000",
"likes": {
"data": [
{
"name": "brocoli",
"category": "Record label",
"id": "27888702146"
},
{
"name": "Agathe Morier",
"id": "601668526"
}
],
"count": 2
},
"comments": {
"count": 0
},
"is_published": true
}
The problem is that the picture link is a low resolution copy of the picture.
How can I get the URL of the full picture ?
Thanks!!
Best
Geoffroy
You can get different version of the photo by querying Graph API with its object_id (not photo post_id which is id in results you provided).
Once you'll request the photo by object id you'll get array of images with URLs and dimensions:
http://graph.facebook.com/10150369820292147?fields=images
If you're attempting to access posts on a Facebook Page (such as for a company) instead of typical user profile, you firstly need to fetch the feed like this:
https://graph.facebook.com/v15.0/YOUR_PAGE_ID_HERE/feed?fields=attachments&access_token=...
And then access data[0].attachments.data[0].subattachments.data[0].target.id to get the object ID (or "target ID" in this case) which you can then use to perform an additional query to obtain the higher resolution image. Increment the numbers to get additional posts and images inside each post.
All you need to do is :
http://graph.facebook.com/me?fields=picture.height(961)
// replace 961 with your required height which u want
You can do this from the main posts list now using
/v2.3/105753476132681/posts?limit=5&fields=likes.summary(true),comments.summary(true), attachments
If attachments doesn't work, try full_picture - but that just gave the 100x100 image for me as well.
Attachments returns a data hash with a 640x480 version of the image at least (not sure what my orig. photo size was)
Use this Code. Its Work for me and get Clear Image
String PICTURE_URL;
String getPicture = hashMap.get("picture");
if (getPicture.contains("_t.")) {
PICTURE_URL = getPicture.replaceAll("_t.", "_n.");
} else if (getPicture.contains("_a.")) {
PICTURE_URL = getPicture.replaceAll("_a.", "_n.");
} else if (getPicture.contains("_s.")) {
PICTURE_URL = getPicture.replaceAll("_s.", "_n.");
} else if (getPicture.contains("_q.")) {
PICTURE_URL = getPicture.replaceAll("_q.", "_n.");
}
url=new URL(PICTURE_URL);
Bitmap bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
((ImageView)view.findViewById(R.id.imageView_FullImage)).setImageBitmap(bitmap);
Though requesting a photo by its object_id will return an array of images with different dimensions, in some cases this approach would require an additional call to the Facebook API.
A simpler approach is to add full_picture to your list of parameters, which will extract the highest resolution image associated with the post.
/v2.2/6275848869/posts?fields=full_picture
For example, if you want to extract all the posts from a Facebook page in the past X days, with the object_id approach you'd need to call the API 3 times:
To get the page info.
To extract the list of posts and obtain the object_id for each post.
For each object_id, to retrieve the list of higher resolution images.
[Note: the first two answers, which includes the one I wrote, do not yet deal with the "optional" fql.multiquery issue.]
When I am using facebook's fql, I can get a list of schools I have attended, or that friends have attended. Specifically, I can get the school's name, and it's facebook id. However, I do not know how to query for deeper information about these schools.
Specifically, I would like to find out where the schools were located. But, I do not know what facebook graph entity (or whatever else) those school ids are part of.
How would I find out from facebook where these schools are located?
Optional: It would be even better if this can be done in the same multiquery that returned the lists of schools in the first place (this would be a query against the user table for my id and another query against the user table for some ids of my friends).
Here's an expanded version of the optional part mentioned in the above paragraph (note that I tried adding this as a separate question, but when I went in make the illustrative data more relevant, I saw that it had silently vanished. So I am assuming I tripped over some feature of stack overflow designed to weed out questions which are too similar to each other. So, instead, let's just say that this is a clarification of what I meant, in the above paragraph)
Using facebook's javascript sdk, this fails, silently:
FB.login(function(response){
disp('loginResponse', response);
var userQuery= FB.Data.query(
'select uid,name,education from user where uid= {0}'
, response.session.uid);
var friendlist = FB.Data.query(
'select uid2 from friend where uid1 = {0} order by rand() limit 10'
, response.session.uid);
var friends = FB.Data.query(
'select uid,name,education from user where uid in (select uid2 from {0})'
, friendlist);
var friendSchools= FB.Data.query(
'select page_id,name,location from page where page_id in (select education.school.id from {0})'
, friends);
self.queries= [userQuery, friendlist, friends, friendSchools];
FB.Data.waitOn(queries
, function() {alert(1)});
})
If I remove the friendSchools element from the queries array, it works just fine, and a friend might be represented by an object like this:
{
uid: '...',
name: '...',
education:
[
{
school:
{
id: '115920001751600',
name: 'Burlington High School'
},
year:
{
id: '138792749476094',
name: '1978'
},
type: 'High School'
},
{
school:
{
id: '20697868961',
name: 'Boston University'
},
degree:
{
id: '188387604516411',
name: 'BS'
},
year:
{
id: '103823546338323',
name: '1982'
},
type: 'College'
}
]
}
So, how do I restructure the where clause in the friendSchools query so that that query can be performed?
In other words, how can I use fql.multiquery to find information about schools (or other such entities) returned elsewhere in the multiquery?
I would suggest using batch requests (more information here: https://developers.facebook.com/docs/reference/api/batch/) to query the graph based on the schools ID you already have. The location of the school can be retrieved in it's default basic information returned (example below).
{
"id": "6192688417",
"name": "Stanford University",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/41571_6192688417_2310209_s.jpg",
"link": "https://www.facebook.com/stanford",
"likes": 203153,
"category": "Education",
"website": "http://www.stanford.edu",
"username": "stanford",
"founded": "1891",
"location": {
"street": "450 Serra Mall",
"city": "Stanford",
"state": "CA",
"country": "United States",
"zip": "94305",
"latitude": 37.42895,
"longitude": -122.1697
},
"public_transit": "http://transportation.stanford.edu",
"general_info": "Located between San Francisco and San Jose in the heart of Silicon Valley, Stanford University is recognized as one of the world's leading research and teaching institutions.\n\nLeland and Jane Stanford founded the University to \"promote the public welfare by exercising an influence on behalf of humanity and civilization.\" Stanford opened its doors in 1891, and more than a century later, it remains dedicated to finding solutions to the great challenges of the day and to preparing our students for leadership in today's complex world.",
"checkins": 9938
}
And, it looks like to get fql to work I want to be querying the page table. For example:
select name,location from page where page_id = 87873693141
(That said, I'm still trying to figure out how to extract the list my education's school ids into the where clause for a multi-query.)