Fix instagram bridge, json data format has been modified on

instagram.com
This commit is contained in:
Paul de Rosanbo 2015-06-29 11:47:54 +02:00
parent d9b2f267c5
commit 9ce826f78e

View file

@ -42,28 +42,26 @@ class InstagramBridge extends BridgeAbstract{
break; break;
} }
$json = trim(substr($innertext, $pos+18), ' =;'); $json = trim(substr($innertext, $pos+18), ' =;');
$data = json_decode($json); $data = json_decode($json);
$userMedia = $data->entry_data->UserProfile[0]->userMedia;
$userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes;
foreach($userMedia as $media) foreach($userMedia as $media)
{ {
$image = $media->images->standard_resolution;
$item = new \Item(); $item = new \Item();
$item->uri = $media->link; $item->uri = "https://instagram.com/p/".$media->code."/";
$item->content = '<img src="' . htmlentities($image->url) . '" width="'.htmlentities($image->width).'" height="'.htmlentities($image->height).'" />'; $item->content = '<img src="' . htmlentities($media->display_src) . '" />';
if (isset($media->caption)) if (isset($media->caption))
{ {
$item->title = $media->caption->text; $item->title = $media->caption;
} else { } else {
$item->title = basename($image->url); $item->title = basename($media->display_src);
} }
$item->timestamp = $media->created_time; $item->timestamp = $media->date;
$this->items[] = $item; $this->items[] = $item;
} }