Skip to content

Commit

Permalink
Merge pull request #451 from bipycxp/master
Browse files Browse the repository at this point in the history
Add getPaginateMediasByUserId method with $count parameter
  • Loading branch information
raiym authored May 28, 2019
2 parents a3a5bba + 2d398be commit 959eafe
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/InstagramScraper/Instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,24 @@ public function getMediaByCode($mediaCode)
public function getPaginateMedias($username, $maxId = '')
{
$account = $this->getAccount($username);

return $this->getPaginateMediasByUserId(
$account->getId(),
Endpoints::getAccountMediasRequestCount(),
$maxId
);
}

/**
* @param int $id
* @param int $count
* @param string $maxId
*
* @return array
* @throws InstagramException
*/
public function getPaginateMediasByUserId($id, $count = 12, $maxId = '')
{
$hasNextPage = false;
$medias = [];

Expand All @@ -562,8 +580,8 @@ public function getPaginateMedias($username, $maxId = '')
];

$variables = json_encode([
'id' => (string)$account->getId(),
'first' => (string)Endpoints::getAccountMediasRequestCount(),
'id' => (string)$id,
'first' => (string)$count,
'after' => (string)$maxId
]);

Expand Down

0 comments on commit 959eafe

Please sign in to comment.