@@ -822,7 +822,7 @@ public function getMediaByUrl($mediaUrl)
822
822
if (!isset ($ mediaArray ['items ' ])) {
823
823
throw new InstagramException ('Media with this code does not exist ' );
824
824
}
825
- return Media::create (current ($ mediaArray ['items ' ]));
825
+ return Media::create (current ($ mediaArray ['items ' ]));
826
826
}
827
827
828
828
/**
@@ -1205,7 +1205,7 @@ public function getMediasByTag($tag, $count = 12, $maxId = '', $minTimestamp = n
1205
1205
throw new InstagramException ('Response decoding failed. Returned data corrupted or this library outdated. Please report issue ' );
1206
1206
}
1207
1207
$ rootKey = array_key_exists ('graphql ' , $ arr ) ? 'graphql ' : 'data ' ;
1208
-
1208
+
1209
1209
if (empty ($ arr [$ rootKey ]['hashtag ' ]['edge_hashtag_to_media ' ]['count ' ])) {
1210
1210
return [];
1211
1211
}
@@ -1800,10 +1800,10 @@ public function getPaginateAllFollowing($accountId, $pageSize = 20, $nextPage =
1800
1800
}
1801
1801
1802
1802
/**
1803
- * Search users by followers
1803
+ * Search users by followers
1804
1804
* @param string $accountId Account id of the profile to query
1805
1805
* @param string $query Query to search by followers
1806
- *
1806
+ *
1807
1807
* @return array
1808
1808
* @throws InstagramException
1809
1809
*/
@@ -1836,10 +1836,10 @@ public function searchFollowers($accountId, $query = '')
1836
1836
}
1837
1837
1838
1838
/**
1839
- * Search users by following
1839
+ * Search users by following
1840
1840
* @param string $accountId Account id of the profile to query
1841
1841
* @param string $query Query to search by following
1842
- *
1842
+ *
1843
1843
* @return array
1844
1844
* @throws InstagramException
1845
1845
*/
@@ -2058,11 +2058,15 @@ public function getCacheKey()
2058
2058
*
2059
2059
* @return bool
2060
2060
*/
2061
- public function isLoggedIn ($ session )
2061
+ public function isLoggedIn ($ session = null )
2062
2062
{
2063
- if ($ session === null || !isset ($ session ['sessionid ' ])) {
2063
+ if ($ session === null ) {
2064
+ $ session = static ::$ instanceCache ->get ($ this ->getCacheKey ());
2065
+ }
2066
+ if (!isset ($ session ['sessionid ' ])) {
2064
2067
return false ;
2065
2068
}
2069
+
2066
2070
$ sessionId = $ session ['sessionid ' ];
2067
2071
$ csrfToken = $ session ['csrftoken ' ];
2068
2072
$ headers = [
0 commit comments