Merge pull request #135 from polo2ro/master
[instagram] Fix instagram bridge JSON format
This commit is contained in:
commit
95af72349b
1 changed files with 9 additions and 11 deletions
|
@ -41,29 +41,27 @@ class InstagramBridge extends BridgeAbstract{
|
||||||
$innertext = $script->innertext;
|
$innertext = $script->innertext;
|
||||||
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue