Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getFollowers($user)
- {
- //Faz requisição na pagina do usuario usando o username para pegar o id
- $userURL = "https://www.instagram.com/{$user}/";
- $userPage = $this->_makeCurl($userURL);
- preg_match("/owner\":\s{\"id\":\s\"(\d+)/",$userPage,$userID);
- $userID = $userID[1];
- preg_match("/followed_by\":\s{\"count\":\s(\d+)/",$userPage,$count_followers);
- $count_followers = $count_followers[1];
- //Requisição para conseguir os 20 primeiros seguidores
- $queryURL = "https://www.instagram.com/query/";
- $post = 'q=ig_user('.$userID.')+%7B%0A++followed_by.first(20)+%7B%0A++++count%2C%0A++++page_info+%7B%0A++++++end_cursor%2C%0A++++++has_next_page%0A++++%7D%2C%0A++++nodes+%7B%0A++++++id%2C%0A++++++is_verified%2C%0A++++++followed_by_viewer%2C%0A++++++requested_by_viewer%2C%0A++++++full_name%2C%0A++++++profile_pic_url%2C%0A++++++username%0A++++%7D%0A++%7D%0A%7D%0A&ref=relationships%3A%3Afollow_list&query_id=17845270936146575';
- $r = $this->_makeCurl($queryURL, $this->_csrf, array("sessionid" => $this->_sessionid),$post);
- print_r($r);
- preg_match("/end_cursor\":\s\"([^\"]+)/",$r,$end_cursor);
- $end_cursor = $end_cursor[1];
- where(preg_match("/has_next_page\": true/",$r))
- {
- $post = 'q=ig_user('.$userID.')+%7B%0A++followed_by.after('.$end_cursor.'%2C+11)+%7B%0A++++count%2C%0A++++page_info+%7B%0A++++++end_cursor%2C%0A++++++has_next_page%0A++++%7D%2C%0A++++nodes+%7B%0A++++++id%2C%0A++++++is_verified%2C%0A++++++followed_by_viewer%2C%0A++++++requested_by_viewer%2C%0A++++++full_name%2C%0A++++++profile_pic_url%2C%0A++++++username%0A++++%7D%0A++%7D%0A%7D%0A&ref=relationships%3A%3Afollow_list&query_id=17845270936146575';
- $r = $this->_makeCurl($queryURL, $this->_csrf, array("sessionid" => $this->_sessionid),$post);
- preg_match("/end_cursor\":\s\"([^\"]+)/",$r,$end_cursor);
- $end_cursor = $end_cursor[1];
- print_r($r);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement