you are in: codestackercodes [RSS] → tag: pagerank [RSS]

[funny] google pagerank code Delicious

show/hide lines
   1  function getPagerank(url) {
   2  	// start off with a random low PR
   3  	pagerank = randomNumber(0, 3);
   4  
   5  	if ( pageHostedOn(url, 'google.com') ) {
   6  		pagerank++;
   7  	}
   8  	else if ( pageHostedOn(url, 'microsoft.com') ) {
   9  		pagerank–;
  10  	}
  11  	
  12  	if ( pageValidates(url) ) {
  13  		pagerank *= .5;
  14  	}
  15  	
  16  	tag_value['b'] = 1;
  17  	tag_value['h2'] = 2;
  18  	tag_value['h1'] = 3;
  19  	tag_value['strong'] = -1; // W3C sux!
  20  	pagerank = calculateTagsPr(tag_value, pagerank);
  21  	
  22  	// Sergey said good news sites have
  23  	// lots of nested tables
  24  	tablesOnPage = getTagCount('table');
  25  	if (tablesOnPage >= 50) {
  26  		pagerank += 2;
  27  	}
  28  	if (pagerank >= 5) {
  29  		pagerank = 4; // helps selling AdWords
  30  	}
  31  	if ( linksFrom('mattcutts.com', url) >= 4 ) {
  32  		// I link to “clean” sites only
  33  		// – Matt, Feb 2006
  34  		pagerank += 2;
  35  	}
  36  	
  37  	pagerank += countBacklinks(url) / 10000;
  38  	blacklist1 = getList('government.cn/censored.txt');
  39  	blacklist2 = getList('c:\larry-page-hatelist.txt');
  40  	
  41  	if ( inArray(blacklist1, url) || inArray(blacklist2, url) ) {
  42  		pagerank = 0;
  43  	}
  44  	
  45  	d = dashesInUrl(url);
  46  	pagerank = (d >= 3) ? pagerank -1 : pagerank + 1;
  47  
  48  	if ( inString(url, “how to build a bomb”) ) {
  49  		// added on request. 2004-12-01.
  50  		recipient = “peter@homelandsecurity.gov”;
  51  		subject = “You might wanna check this…”;
  52  		sendMailTo(recipient, subject, url);
  53  		// page might still be relevant
  54  		pagerank++;
  55  	}
  56  
  57  	if ( month() == "June" || month() == "October" ) {
  58  		// makes people talk about
  59  		// PR updates, good publicity
  60  		pagerank -= randomNumber(1,3);
  61  	} 
  62  
  63  	if ( linkCol(url) == WHITE &&
  64  		pageCol(url) == WHITE ) {
  65  		// spammer!! Googleaxe it!!
  66  		pagerank = 0;
  67  	}
  68  
  69  	if (url == “http://www.nytimes.com”) {
  70  		// just testing, pls remove tomorrow
  71  		// – Frank, June 2003
  72  		pagerank = 10;
  73  	}
  74  	return pagerank;
  75  }
created by leozera — 11 July 2008 — get a short url — tags: google humor pagerank embed