Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Salva in un file tutti gli url appartenenti ad un gruppo.
- //Script scritto in fretta e furia, non ottimizzato, alla cazzo. Funziona per miracolo. Insomma: nessuna garanzia.
- //Una sola cosa: se lo usate per creare "opere pubbliche", almeno citatemi.
- //Enrico Ronconi <enrico.ronconi.p@gmail.com> - 23 Nov 2016
- $context = stream_context_create(array('http' => array('header'=>'Connection: close\r\n')));
- function add_ids($ids_array,$data){
- foreach ($data as $user) {
- array_push($ids_array, [$user["name"],$user["id"]]);
- }
- return $ids_array;
- }
- $at="access token here";
- $resp = file_get_contents("https://graph.facebook.com/v2.8/831654706902078/members?limit=750&access_token=$at",false,$context);
- $resp = json_decode($resp,true);
- $ids = add_ids(array(),$resp["data"]);
- $limit = false;
- while(array_key_exists("next",$resp["paging"])){
- $resp = file_get_contents($resp["paging"]["next"],false,$context);
- $resp = json_decode($resp,true);
- $ids = add_ids($ids,$resp["data"]);
- echo("Raccolti: ".(string)count($ids)."\n");
- //var_dump($resp["paging"]);
- usleep(1000*250);
- if($limit){
- if(count($ids)>=$limit) break;
- }
- }
- $only_id = array();
- foreach($ids as $id){
- array_push($only_id,$id[1]);
- file_put_contents("ids.txt",$id[1]."\n",FILE_APPEND);
- file_put_contents("idsn.txt",$id[0]." -> ".$id[1]."\n",FILE_APPEND);
- }
- $passo = 50;
- $pos = 0;
- while($pos<=count($ids)){
- echo($pos."/".count($ids)."\n");
- $request = implode(",",array_slice($only_id,$pos,$passo));
- //echo("https://graph.facebook.com/v2.8/picture?redirect=0&ids=$request&access_token=$at\n");
- $resp = file_get_contents("https://graph.facebook.com/v2.8/picture?redirect=0&ids=$request&access_token=$at",false,$context);
- echo('-');
- $resp = json_decode($resp,true);
- foreach(array_slice($only_id,$pos,$passo) as $x){
- echo('.');
- file_put_contents("urls.txt",$resp[$x]["data"]["url"]."\n",FILE_APPEND);
- $tmp = explode("/",$resp[$x]["data"]["url"]);
- file_put_contents("urlsid.txt",$tmp[substr_count($resp[$x]["data"]["url"],"/")]." ".$x.".jpg\n",FILE_APPEND);
- //file_put_contents("pics/$x.jpg",file_get_contents($resp[$x]["data"]["url"],false,$context));
- }
- echo('\n');
- $pos += $passo;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement