[Google] Javascript Trick to Quickly Extract Google Result Urls directly from your Browser

Status
Not open for further replies.

nemsis

Junior Member
Joined
Sep 27, 2009
Messages
197
Reaction score
294
Hi,

I was in need of a quick solution to extract google serp urls without having to run a scraper so I wrote this little script. I decided to share it because last time I shared a js code people loved it :)

Step 1: Go to any google serp
Code:
Example: http://www.google.com/search?q=example

Step 2: Paste this javascript code in your browser location bar
Code:
javascript: /* nemsis 4 bhw */ function g_rs() { var serpl = [];  for (var i=0; i < document.links.length; i++) {if  (document.links[i].getAttribute("class")=="l"){serpl[serpl.length] =  document.links[i];}}var gstr = ""; for (var i=0; i<serpl.length; i++)  {gstr += serpl[i] + "<br />";} gstr += "<p>Number of URLs:  "+serpl.length+"</p>"; gstr +=  unescape("%3C%70%3E%3C%73%6D%61%6C%6C%3E%6E%65%6D%73%69%73%20%34%20%3C%61%20%68%72%65%66%3D%27%68%74%74%70%3A%2F%2F%77%77%77%2E%62%6C%61%63%6B%68%61%74%77%6F%72%6C%64%2E%63%6F%6D%2F%62%6C%61%63%6B%68%61%74%2D%73%65%6F%2F%69%6E%64%65%78%2E%70%68%70%3F%72%65%66%65%72%72%65%72%69%64%3D%36%39%30%38%33%27%3E%62%68%77%3C%2F%61%3E%3C%2F%73%6D%61%6C%6C%3E%3C%2F%70%3E");  /* nemsis 4 bhw */ document.write(gstr); } g_rs();

I hope this will be useful for some of you.

Step 3: Enjoy and press the thanks button :)
 
Very usefule script, also it would be more useful if the script would extract results from more than 1 page

good job nemsis
 
Awesome script, doesn't seem to grab all the URLs though, not +1ed ones anyway :)
 
Thanks, it doesnt seem to do anything anymore tho , probably google changed algos? Any other way to extract all titles of a google search?
 
Thanks, it doesnt seem to do anything anymore tho , probably google changed algos? Any other way to extract all titles of a google search?

Make sure you manually type in "javascript" as most browsers don't allow C+P.
 
Status
Not open for further replies.
Back
Top