@@ -1796,6 +1796,80 @@ public function getPaginateAllFollowing($accountId, $pageSize = 20, $nextPage =
17961796 'accounts ' => $ accounts
17971797 ];
17981798 }
1799+
1800+ /**
1801+ * Search users by followers
1802+ * @param string $accountId Account id of the profile to query
1803+ * @param string $query Query to search by followers
1804+ *
1805+ * @return array
1806+ * @throws InstagramException
1807+ */
1808+ public function searchFollowers ($ accountId , $ query = '' )
1809+ {
1810+ $ response = Request::get (
1811+ Endpoints::getFollowersUrl_v1 ($ accountId ),
1812+ array_merge (
1813+ ['x-ig-app-id ' => self ::X_IG_APP_ID ],
1814+ $ this ->generateHeaders ($ this ->userSession )
1815+ ),
1816+ array (
1817+ "search_surface " => "follow_list_page " ,
1818+ "query " => $ query ,
1819+ "enable_groups " => "true "
1820+ )
1821+ );
1822+
1823+ if ($ response ->code !== static ::HTTP_OK ) {
1824+ throw new InstagramException ('Response code is ' . $ response ->code . '. Body: ' . static ::getErrorBody ($ response ->body ) . ' Something went wrong. Please report issue. ' , $ response ->code );
1825+ }
1826+
1827+ $ jsonResponse = $ this ->decodeRawBodyToJson ($ response ->raw_body );
1828+
1829+ if ($ jsonResponse ['status ' ] !== 'ok ' ) {
1830+ throw new InstagramException ('Response status is ' . $ jsonResponse ['status ' ] . '. Body: ' . static ::getErrorBody ($ response ->body ) . ' Something went wrong. Please report issue. ' , $ response ->code );
1831+ }
1832+
1833+ return $ jsonResponse ;
1834+ }
1835+
1836+ /**
1837+ * Search users by following
1838+ * @param string $accountId Account id of the profile to query
1839+ * @param string $query Query to search by following
1840+ *
1841+ * @return array
1842+ * @throws InstagramException
1843+ */
1844+ public function searchFollowing ($ accountId , $ query = '' )
1845+ {
1846+ $ response = Request::get (
1847+ Endpoints::getFollowingUrl_v1 ($ accountId ),
1848+ array_merge (
1849+ ['x-ig-app-id ' => self ::X_IG_APP_ID ],
1850+ $ this ->generateHeaders ($ this ->userSession )
1851+ ),
1852+ array (
1853+ "includes_hashtags " => "false " ,
1854+ "search_surface " => "follow_list_page " ,
1855+ "query " => $ query ,
1856+ "enable_groups " => "true "
1857+ )
1858+ );
1859+
1860+ if ($ response ->code !== static ::HTTP_OK ) {
1861+ throw new InstagramException ('Response code is ' . $ response ->code . '. Body: ' . static ::getErrorBody ($ response ->body ) . ' Something went wrong. Please report issue. ' , $ response ->code );
1862+ }
1863+
1864+ $ jsonResponse = $ this ->decodeRawBodyToJson ($ response ->raw_body );
1865+
1866+ if ($ jsonResponse ['status ' ] !== 'ok ' ) {
1867+ throw new InstagramException ('Response status is ' . $ jsonResponse ['status ' ] . '. Body: ' . static ::getErrorBody ($ response ->body ) . ' Something went wrong. Please report issue. ' , $ response ->code );
1868+ }
1869+
1870+ return $ jsonResponse ;
1871+ }
1872+
17991873 /**
18001874 * @param array $reel_ids - array of instagram user ids
18011875 * @return array
0 commit comments