Skip to content

Commit

Permalink
Fix bug In pagination in getMediasByTag() and getMedias() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
raiym committed Jun 6, 2016
1 parent 47ce723 commit b23e4e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/InstagramScraper/Instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public function getMedias($username, $count = 20)
$medias[] = Media::fromApi($mediaArray);
$index++;
}
if (count($arr['items']) == 0) {
return $medias;
}
$maxId = $arr['items'][count($arr['items']) - 1]['id'];
$isMoreAvailable = $arr['more_available'];
}
Expand Down Expand Up @@ -107,6 +110,9 @@ public function getMediasByTag($tag, $count = 12)
$medias[] = Media::fromTagPage($mediaArray);
$index++;
}
if (count($nodes) == 0) {
return $medias;
}
$maxId = $nodes[count($nodes) - 1]['id'];
$hasNextPage = $arr['tag']['media']['page_info']['has_next_page'];
}
Expand Down

0 comments on commit b23e4e9

Please sign in to comment.