Skip to content
This repository has been archived by the owner on Apr 16, 2018. It is now read-only.

Commit

Permalink
Merge pull request #6 from ricardo118/patch-1
Browse files Browse the repository at this point in the history
Fix for issue #5 Undefined property
  • Loading branch information
dannystey authored Mar 19, 2018
2 parents f22d44e + b1108c1 commit 5462b51
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions instagram-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,18 @@ private function parseData($json) {

$data = json_decode($json);

if($data->user->username == $this->username) {
$result = $data->user->media->nodes;
if($data->graphql->user->username == $this->username) {
$result = $data->graphql->user->edge_owner_to_timeline_media->edges;
// bring it back to the old syntax
return array_map(function ($item) {
$item->images = (object) array(
'thumbnail' => (object) array(
'url' => $item->thumbnail_src
'url' => $item->node->thumbnail_src
)
);
$item->link = 'https://www.instagram.com/p/' . $item->code;
$item->caption = $item->node->edge_media_to_caption->edges[0]->node->text;
$item->date = $item->node->taken_at_timestamp;
$item->link = 'https://www.instagram.com/p/' . $item->node->shortcode;
return $item;
}, $result);
}
Expand Down

0 comments on commit 5462b51

Please sign in to comment.