KiberInfinity

google scan

Aug 14th, 2013
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function jquery_load(callback){
  2.    if (window.jQuery){
  3.       callback();
  4.       return;
  5.    }
  6.    var js=document.createElement('script');
  7.    js.src='//code.jquery.com/jquery-1.10.2.min.js';
  8.    document.body.appendChild(js);
  9.    function check(){
  10.       if (window.jQuery) callback();
  11.       else setTimeout(check,10);
  12.    }
  13.    check();
  14. }
  15.  
  16. function google_scan(){
  17.    var idx=0;
  18.    var i=0;
  19.    jquery_load(function(){
  20.       $('#ires').html(' ');
  21.       $('#ires').append('<style>ol#qwqwqw li{list-style-type:decimal;}</style>');
  22.       var cont=$('<ol id="qwqwqw" style="list-style-type:decimal;"></ol>');
  23.       $('#ires').append(cont);
  24.      
  25.       var next_link=$('#pnnext').attr('href');
  26.       function go(){
  27.          $.get(next_link,function(text){
  28.             var d=$(text);
  29.             next_link=d.find('#pnnext').attr('href');
  30.             d.find('h3.r a').each(function(i,k){
  31.                cont.append('<li><a href="'+k.href+'">'+k.href+'</a></li>');
  32.                console.log(k);
  33.             })
  34.            
  35.             if (next_link) setTimeout(go,Math.round(Math.random()*1000));
  36.          });
  37.       }
  38.       go();
  39.    });
  40. }
  41.  
  42. google_scan();
Add Comment
Please, Sign In to add comment