I am using this API call to get the Page's Post details and this one includes the Post's Video Source.
https://graph.facebook.com/v5.0/{page id}/posts?fields=from{id,name,picture},status_type,attachments,full_picture,picture,message,story,properties,created_time,shares,comments.limit(0).summary(true).as(comments),likes.limit(0).summary(true).as(likes),permalink_url
This API call responds with these data:
{
"from": {
"id": "123123",
"name": "abcd",
"picture": {
"data": {
"height": 50,
"is_silhouette": false,
"url": "https://scontent.fmnl4-6.fna.fbcdn.net/v/t1.0-1/cp0/p50x50/123123_123123",
"width": 50
}
}
},
"status_type": "added_video",
"attachments": {
"data": [
{
"media": {
"image": {
"height": 405,
"src": "https://fb.com/adsfasdf",
"width": 720
},
"source": "https://video-fb-source.com.fb.mp4?_nc_cat=1231&cb=3"
},
"target": {
"id": "240206797735633",
"url": "https://www.facebook.com/asd1asdfasdf"
},
"title": "test 123123",
"type": "video_autoplay",
"url": "https://www.facebook.com/hahahae/videos/240206797735633/"
}
]
},
"full_picture": "https://scontent.fmnl4-6.fna.fbcdn.net/v/t15.5256-10/145288627_240218977734415_42016794327.jpg?",
"picture": "https://scontent.fmnl4-6.fna.fbcdn.net/v/t15.5256-10/145288627_240218977734415_42016794327.jpg?",
"message": "haha hahahaha",
"properties": [
{
"name": "Length",
"text": "41:20"
}
],
"created_time": "2021-02-15T18:00:01+0000",
"shares": {
"count": 7
},
"comments": {
"data": [
],
"summary": {
"order": "ranked",
"total_count": 1,
"can_comment": true
}
},
"likes": {
"data": [
],
"summary": {
"total_count": 16,
"can_like": true,
"has_liked": false
}
},
"permalink_url": "https://www.facebook.com/xxxx/posts/xxx/",
"id": "xxxx_123123_xxx"
},
I get the Post's Video Source from the attachments.data[0].media.source json, then every time I get the video, I download it on my local.
My problem with that is it does not return a high-quality video, it's a bit pixelated. Unlike in Facebook, when you go directly to the video URL, there's a 1080p option.
How can I get a high-quality video that I can download through Facebook's Graph API?
Thanks.
Related
I have this object with youtube video keys:
{
"id": 321612,
"results": [
{
"id": "589219bfc3a368096a009a41",
"iso_639_1": "en",
"iso_3166_1": "US",
"key": "tWapqpCEO7Y",
"name": "Belle Motion Poster",
"site": "YouTube",
"size": 720,
"type": "Clip"
},
{
"id": "5743a07a9251414c0d000605",
"iso_639_1": "en",
"iso_3166_1": "US",
"key": "c38r-SAnTWM",
"name": "Official US Teaser Trailer",
"site": "YouTube",
"size": 1080,
"type": "Trailer"
},
{
"id": "589219d3c3a36809660098dd",
"iso_639_1": "en",
"iso_3166_1": "US",
"key": "bgeSXHvPoBI",
"name": "Lumiere Motion Poster",
"site": "YouTube",
"size": 720,
"type": "Clip"
}
}
What I want to do is play this as a playlist on a Jwplayer.
<div id="myElement"></div>
<script type="text/javascript">
var playerInstance = jwplayer("myElement");
playerInstance.setup({
'image': '{{$movie->poster_path}}',
file: '//www.youtube.com/watch?v={{reset($movievideo)->key}}',
});
</script>
How can I achieve this, so that when the first video ends, the next on the object list is played?
Im working with Laravel 5.1 and have a small issue.
I am sending a JSON response from Instagram's API for most popular media from my controller and want to grab that response in my view with ajax and show it on page to the user without loading the entire page.
I am trying to grab the username and display it in my view to the user.
Right now nothing happens and the console does not show anything, it is empty.
This is my code:
CONROLLER:
public function PopularPics(City $city){
try{
$jsonData = $city->getMostPopularPics();
return response()->json($jsonData);
}catch(\Exception $ex){
return $ex->getCode();
}
}
VIEW
<ul id="theData">
</ul>
<script>
$(function(){
$("#JRequest").click(function(e){
e.preventDefault();
$.ajax({
type: "GET",
url: "popular",
dataType:"json",
success:function(items){
$.each(items.data,function(i,item){
console.log(item.user.username);
});
}
});
});
});
</script>
INSTAGRAM JSON
{
"data": [{
"type": "image",
"users_in_photo": [],
"filter": "Gotham",
"tags": [],
"comments": { ... },
"caption": {
"created_time": "1296656006",
"text": "ãã¼ãâ¥ã¢ããªå§ãã¦ä½¿ã£ã¦ã¿ãã(^^)",
"from": {
"username": "cocomiin",
"full_name": "",
"type": "user",
"id": "1127272"
},
"id": "26329105"
},
"likes": {
"count": 35,
"data": [{
"username": "mikeyk",
"full_name": "Kevin S",
"id": "4",
"profile_picture": "..."
}, {...subset of likers...}]
},
"link": "http://instagr.am/p/BV5v_/",
"user": {
"username": "cocomiin",
"full_name": "Cocomiin",
"profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1127272_75sq_1296145633.jpg",
"id": "1127272"
},
"created_time": "1296655883",
"images": {
"low_resolution": {
"url": "http://distillery.s3.amazonaws.com/media/2011/02/01/34d027f155204a1f98dde38649a752ad_6.jpg",
"width": 306,
"height": 306
},
"thumbnail": {
"url": "http://distillery.s3.amazonaws.com/media/2011/02/01/34d027f155204a1f98dde38649a752ad_5.jpg",
"width": 150,
"height": 150
},
"standard_resolution": {
"url": "http://distillery.s3.amazonaws.com/media/2011/02/01/34d027f155204a1f98dde38649a752ad_7.jpg",
"width": 612,
"height": 612
}
},
"id": "22518783",
"location": null
},
{
"type": "video",
"videos": {
"low_resolution": {
"url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_102.mp4",
"width": 480,
"height": 480
},
"standard_resolution": {
"url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_101.mp4",
"width": 640,
"height": 640
},
"users_in_photo": null,
"filter": "Vesper",
"tags": [],
"comments": {
"data": [{
"created_time": "1279332030",
"text": "Love the sign here",
"from": {
"username": "mikeyk",
"full_name": "Mikey Krieger",
"id": "4",
"profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1242695_75sq_1293915800.jpg"
},
"id": "8"
},
{
"created_time": "1279341004",
"text": "Chilako taco",
"from": {
"username": "kevin",
"full_name": "Kevin S",
"id": "3",
"profile_picture": "..."
},
"id": "3"
}],
"count": 2
},
"caption": null,
"likes": {
"count": 1,
"data": [{
"username": "mikeyk",
"full_name": "Mikeyk",
"id": "4",
"profile_picture": "..."
}]
},
"link": "http://instagr.am/p/D/",
"user": {
"username": "kevin",
"full_name": "Kevin S",
"profile_picture": "...",
"id": "3"
},
"created_time": "1279340983",
"images": {
"low_resolution": {
"url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_6.jpg",
"width": 306,
"height": 306
},
"thumbnail": {
"url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_5.jpg",
"width": 150,
"height": 150
},
"standard_resolution": {
"url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_7.jpg",
"width": 612,
"height": 612
}
},
"id": "3",
"location": null
},
...]
}
I have used the Facebook graph link in my site, I have tried for the last two days but I am not able to fix this problem. For two months this code has been working fine but right now it is not working.
Here is the Link
https://graph.facebook.com/157705150944797/photos/uploaded
Why do I get this error?
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
But when I use the following link I will get a response
https://graph.facebook.com/157705150944797/photos/
{
"data": [
{
"id": "212708942111084",
"from": {
"category": "Local business",
"category_list": [
{
"id": "206284062724685",
"name": "Roofer"
}
],
"name": "Blue Sky Roofing, Inc.",
"id": "157705150944797"
},
"picture": "https://m.ak.fbcdn.net/sphotos-e.ak/hphotos-ak-xap1/v/t1.0-9/p130x130/284949_212708942111084_583574_n.jpg?oh=3554b061f512bb97cb577049578d5532&oe=54D26E47&__gda__=1427888341_67dd755838624aa1e322faa03d8e4325",
"source": "https://m.ak.fbcdn.net/sphotos-e.ak/hphotos-ak-xap1/v/t1.0-9/284949_212708942111084_583574_n.jpg?oh=8e26df9a434160f154dc0a4ad6690fad&oe=54D99C4B&__gda__=1424573780_940c191fc86f99e5316f39a70336606c",
"height": 445,
"width": 445,
"images": [
{
"height": 445,
"width": 445,
"source": "https://m.ak.fbcdn.net/sphotos-e.ak/hphotos-ak-xap1/v/t1.0-9/284949_212708942111084_583574_n.jpg?oh=8e26df9a434160f154dc0a4ad6690fad&oe=54D99C4B&__gda__=1424573780_940c191fc86f99e5316f39a70336606c"
},
...
I don't know why I get that error when I use this link. I want to get all the uploaded photos in the site.
https://graph.facebook.com/157705150944797/photos/uploaded
I am trying to access the urls of the first images that show up for tumblr searches using the tag search api. Below is the json for the test search I'm using.
{
"meta": {
"status": 200,
"msg": "OK"
},
"response": [
{
"blog_name": "m00tzman",
"id": 37918165271,
"post_url": "http://m00tzman.tumblr.com/post/37918165271/test-image-for-tumblr-a…",
"slug": "test-image-for-tumblr-api-thingy",
"type": "photo",
"date": "2012-12-14 18:13:25 GMT",
"timestamp": 1355508805,
"state": "published",
"format": "html",
"reblog_key": "IwlKk9r4",
"tags": [
"g6845e"
],
"highlighted": [ ],
"note_count": 29,
"caption": "<p>test image for tumblr api thingy</p>",
"photos": [
{
"caption": "",
"alt_sizes": [
{
"width": 500,
"height": 628,
"url": "http://25.media.tumblr.com/af60fbe390c487125501e50b37781317/tumblr_…"
},
{
"width": 400,
"height": 502,
"url": "http://25.media.tumblr.com/af60fbe390c487125501e50b37781317/tumblr_…"
},
{
"width": 250,
"height": 314,
"url": "http://25.media.tumblr.com/af60fbe390c487125501e50b37781317/tumblr_…"
},
{
"width": 100,
"height": 126,
"url": "http://24.media.tumblr.com/af60fbe390c487125501e50b37781317/tumblr_…"
},
{
"width": 75,
"height": 75,
"url": "http://24.media.tumblr.com/af60fbe390c487125501e50b37781317/tumblr_…"
}
],
"original_size": {
"width": 500,
"height": 628,
"url": "http://25.media.tumblr.com/af60fbe390c487125501e50b37781317/tumblr_…"
}
}
]
}
]
}
My problem is that I am not able to echo out the url for the "original size" image. Here is my code so far:
<?php
$search = file_get_contents('http://api.tumblr.com/v2/tagged?tag=g6845e&api_key=(api key)');
$tumblrdata = json_decode($search, true);
$photos = $tumblrdata['photos']['original_size'];
$url = $photos['url'];
echo $url;
?>
Any guesses on what is going wrong here?
Try
$photos = $tumblrdata['response']['photos'][0]['original_size'];
This app is posting to the user's timeline, using PHP and Facebook's PHP API implementation. This is working right now, for over several weeks already.
The following PHP code is being used to post a message:
if($hasPhoto === TRUE)
{
// Post to FB with picture
$facebook->setFileUploadSupport(true);
$result = $facebook->api("/me/photos", "post", array(
'message' => $message,
'place' => $place,
'source' => '#' . $photo
));
}
else
{
// Post to FB without picture
$result = $facebook->api("/me/feed", "post", array(
'message' => $message,
'place' => $place
));
}
This is working properly, except there are two formattings of the $result:
array ('id' => '103240856515XXX', )
array ('id' => '100004900175XXX_103239809849XXX', )
The Graph API documentation tells us the following:
A post from Facebook Platform: https://graph.facebook.com/19292868552_10150189643478553
A status message on the Facebook Page: https://graph.facebook.com/10150224661566729
This means the used PHP code generates posts ór status messages. I don´t see any relation between the textmessages, photos, dates, or authors. It seems to happen randomly.
The following shows the relationship from our data between the format of the id and whether a photo is attached.
select count(*) from fbposts where facebookpostid like '%\_%' and hasphoto = 1; -- 90
select count(*) from fbposts where facebookpostid like '%\_%' and hasphoto = 0; -- 87
select count(*) from fbposts where facebookpostid not like '%\_%' and hasphoto = 1; -- 47
select count(*) from fbposts where facebookpostid not like '%\_%' and hasphoto = 0; -- 54
Why does this behaviour happen? How to force a Post? The reason why this is relevant is because Post does have a Privacy property which I would like to query.
Update:
Querying a status message 545778052106XXX, given by the FB API, with a photo, gives me:
{
"id": "545778052106XXX",
"from": {
"name": "Jeffrey Krist",
"id": "100000226354XXX"
},
"name": "My message!",
"picture": "http://photos-f.ak.fbcdn.net/hphotos-ak-ash3/522827_545778052106XXX_1151562XXX_s.jpg",
"source": "http://sphotos-f.ak.fbcdn.net/hphotos-ak-ash3/s720x720/522827_545778052106XXX_1151562XXX_n.jpg",
"height": 720,
"width": 720,
"images": [
{
"height": 2048,
"width": 2048,
"source": "http://sphotos-f.ak.fbcdn.net/hphotos-ak-ash3/s2048x2048/522827_545778052106XXX_1151562XXX_n.jpg"
}, .. lots more
],
"link": "https://www.facebook.com/photo.php?fbid=545778052106402&set=p.545778052106XXX&type=1",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v2/yz/r/StEh3RhPXXX.gif",
"place": {
"id": "182665821805XXX",
"name": "A company name",
"location": {
"street": "My street 13", ..
}
},
"created_time": "2012-11-01T08:35:20+0000",
"updated_time": "2012-11-01T08:35:20+0000",
"comments": ...
"likes": ...
}
Querying a post message using a id from the FB API gives me:
{
"id": "100003331805XXX_299609210160XXX",
"from": {
"name": "Some name",
"id": "100003331805XXX"
},
"message": "My message",
"picture": "http://photos-e.ak.fbcdn.net/hphotos-ak-ash3/560724_299609200160XXX_789651XXX_s.jpg",
"link": "https://www.facebook.com/photo.php?fbid=299609200160XXX&set=a.285494101571XXX.69331.100003331805XXX&type=1&relevant_count=1",
"name": "Photo album name",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v2/yz/r/StEh3RhPXXX.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/100003331805XXX/posts/299609210160XXX"
},
{
"name": "Like",
"link": "https://www.facebook.com/100003331805XXX/posts/299609210160XXX"
}
],
"privacy": {
"value": "ALL_FRIENDS", ...
},
"place": {
"id": "174171872642XXX", ...
},
"type": "photo",
"status_type": "added_photos",
"object_id": "299609200160XXX",
"application": {
"name": "My app", ...
},
"created_time": "2012-12-21T22:33:59+0000",
"updated_time": "2012-12-21T23:30:39+0000",
"likes": ...
"comments": ...
}
Querying a composed id, _ ('100000226354XXX_545778052106XXX'), which is message with a photo, gives me:
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
There is no need to force a post when each status message is a post object.
Status message object 10100948019328597
Post object userid_10100948019328597
Status message object
{
"id": "10100948019328597",
"from": {
"name": "phwd",
"id": "13608786"
},
"message": "Happy Thanksgiving you cool Canadians!",
"updated_time": "2012-10-08T23:17:27+0000",
"likes": {
"data": [
],
"paging": {
"next":
}
}
}
Post object
{
"id": "13608786_10100948019328597",
"from": {
"name": "phwd",
"id": "13608786"
},
"message": "Happy Thanksgiving you cool Canadians!",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/13608786/posts/10100948019328597"
},
{
"name": "Like",
"link": "http://www.facebook.com/13608786/posts/10100948019328597"
}
],
"privacy": {
"description": "Public",
"value": "EVERYONE",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"type": "status",
"status_type": "mobile_status_update",
"created_time": "2012-10-08T23:17:28+0000",
"updated_time": "2012-10-08T23:17:28+0000",
"likes": {
"data": [
]
},
"comments": {
"count": 0
}
}
The best way to check would be to compare /me/statuses vs /me/posts