Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.93 KB | None | 0 0
  1.         function getFollowers($user)
  2.         {
  3.             //Faz requisição na pagina do usuario usando o username para pegar o id          
  4.             $userURL = "https://www.instagram.com/{$user}/";
  5.             $userPage = $this->_makeCurl($userURL);
  6.             preg_match("/owner\":\s{\"id\":\s\"(\d+)/",$userPage,$userID);
  7.             $userID = $userID[1];
  8.  
  9.  
  10.             preg_match("/followed_by\":\s{\"count\":\s(\d+)/",$userPage,$count_followers);
  11.             $count_followers = $count_followers[1];
  12.  
  13.             //Requisição para conseguir os 20 primeiros seguidores
  14.             $queryURL = "https://www.instagram.com/query/";
  15.             $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';
  16.             $r = $this->_makeCurl($queryURL, $this->_csrf, array("sessionid" => $this->_sessionid),$post);
  17.             print_r($r);
  18.             preg_match("/end_cursor\":\s\"([^\"]+)/",$r,$end_cursor);
  19.             $end_cursor = $end_cursor[1];
  20.        
  21.            
  22.                 where(preg_match("/has_next_page\": true/",$r))
  23.                 {  
  24.                        
  25.                     $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';
  26.                     $r = $this->_makeCurl($queryURL, $this->_csrf, array("sessionid" => $this->_sessionid),$post);
  27.                     preg_match("/end_cursor\":\s\"([^\"]+)/",$r,$end_cursor);
  28.                     $end_cursor = $end_cursor[1];
  29.                     print_r($r);
  30.                 }
  31.  
  32.            
  33.            
  34.            
  35.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement