1
0
Fork 0
forked from blallo/rss-bridge

Merge pull request #135 from polo2ro/master

[instagram] Fix instagram bridge JSON format
This commit is contained in:
Mitsu 2015-06-29 13:44:28 +02:00
commit 95af72349b

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;
} }