[英]Get Facebook wall post (stream) photo URL using FQL query
I'm trying to get the URL for the original image when a user posts in my wall. 当用户在我的墙上张贴信息时,我正在尝试获取原始图像的URL。 So for I'm doing this to retrieve the wall posts: 因此,对于我来说,这是检索墙贴的方法:
SELECT attachment, actor_id, type, place, message, description FROM stream WHERE source_id = me()
In attachment is where the photo info lays, however, I tried uploading different photos of different sizes and the parameters aren't always the same. 但是,附件中包含照片信息,但是我尝试上传不同大小的不同照片,并且参数并不总是相同。
"attachment": {
"media": [
{
"href": "https://www.facebook.com/photo.php?fbid=&set=a.xxxxxxxxxxxxxxx&type=1&relevant_count=1",
"alt": "novo post de imagem",
"type": "photo",
"src": "https://fbcdn-photos-f-a.akamaihd.net/hphotos-ak-prn2/1461152_604407632928327_57092530_s.jpg",
"photo": {
"aid": "************_1715",
"pid": "************_1073741835",
"fbid": 604407632928327,
"owner": ************,
"index": 1,
"width": 1024,
"height": 768,
"images": [
{
"src": "https://fbcdn-photos-f-a.akamaihd.net/hphotos-ak-prn2/1461152_604407632928327_57092530_s.jpg",
"width": 130,
"height": 97
},
{
"src": "https://scontent-b.xx.fbcdn.net/hphotos-prn2/s720x720/1461152_604407632928327_57092530_n.jpg",
"width": 720,
"height": 540
}
]
}
}
],
"name": "",
"caption": "",
"description": "",
"properties": [
],
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif",
"fb_object_type": "photo",
"fb_object_id": "************_1073741835"
},
"actor_id": ************,
"type": 247,
"place": null,
"message": "novo post de imagem",
"description": null
}
Since I can't always get the original photo URL with this data, I was thinking of getting the photo from the photo
or photo_src
tables, however, every code I have in this JSON does not work to retrieve any image, and the aid
and pid
have to be passed as strings because of the underscore. 因为我不能总是用这个数据得到原始照片网址,我想从获得照片的photo
或photo_src
但是表,每个代码我在这个JSON不起作用检索任何图像,以及aid
和由于下划线,必须将pid
作为字符串传递。
My question is: what code in here can I use to get the photo from another table (possibly photo
or photo_src
) and what is the correct query to do it? 我的问题是:这里可以使用什么代码从另一个表(可能是photo
或photo_src
)中获取照片,正确的查询是什么?
Figured out what was wrong. 找出问题所在。 I was missing the user_photos
permission in my access token. 我在访问令牌中缺少user_photos
权限。 My code is fine and the ID I should use to query the photo is the pid
. 我的代码很好,用于查询照片的pid
是pid
。
However I think some kind of error would be nice, given that a null result lead me to believe my query was wrong, not that I had a missing permission. 但是,我认为某种错误会很好,因为空结果使我相信我的查询是错误的,而不是我没有丢失的权限。
So the query should be something like this: 因此查询应该是这样的:
SELECT src_big FROM photo WHERE pid = "************_1073741835"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.