From a3f44b1acc82f91ddb696f01afae13f8936c0b99 Mon Sep 17 00:00:00 2001 From: shibby Date: Tue, 13 Feb 2018 19:44:32 +0300 Subject: [PATCH] fix getCurrentTopMediasByTagName --- src/InstagramScraper/Instagram.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/InstagramScraper/Instagram.php b/src/InstagramScraper/Instagram.php index feb1305e..76f89ed3 100644 --- a/src/InstagramScraper/Instagram.php +++ b/src/InstagramScraper/Instagram.php @@ -733,8 +733,9 @@ public function getCurrentTopMediasByTagName($tagName) $this->userSession['csrftoken'] = $cookies['csrftoken']; $jsonResponse = json_decode($response->raw_body, true, 512, JSON_BIGINT_AS_STRING); $medias = []; - foreach ($jsonResponse['tag']['top_posts']['nodes'] as $mediaArray) { - $medias[] = Media::create($mediaArray); + $nodes = (array) @$jsonResponse['graphql']['hashtag']['edge_hashtag_to_media']['edges']; + foreach ($nodes as $mediaArray) { + $medias[] = Media::create($mediaArray['node']); } return $medias; }