From 9ce826f78e255de14461654748e9fab47fb09755 Mon Sep 17 00:00:00 2001 From: Paul de Rosanbo Date: Mon, 29 Jun 2015 11:47:54 +0200 Subject: [PATCH] Fix instagram bridge, json data format has been modified on instagram.com --- bridges/InstagramBridge.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php index a150c64d..93e1a183 100644 --- a/bridges/InstagramBridge.php +++ b/bridges/InstagramBridge.php @@ -41,29 +41,27 @@ class InstagramBridge extends BridgeAbstract{ $innertext = $script->innertext; break; } - - - + $json = trim(substr($innertext, $pos+18), ' =;'); $data = json_decode($json); - $userMedia = $data->entry_data->UserProfile[0]->userMedia; - + + + $userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes; foreach($userMedia as $media) { - $image = $media->images->standard_resolution; $item = new \Item(); - $item->uri = $media->link; - $item->content = ''; + $item->uri = "https://instagram.com/p/".$media->code."/"; + $item->content = ''; if (isset($media->caption)) { - $item->title = $media->caption->text; + $item->title = $media->caption; } else { - $item->title = basename($image->url); + $item->title = basename($media->display_src); } - $item->timestamp = $media->created_time; + $item->timestamp = $media->date; $this->items[] = $item; }