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; }