Chapter 4

rankingfactors.pl

#!/usr/local/bin/perl ########################################################### # File: rankingfactors.pl # # Description: This script performs analysis on several # # ranking factors including: # # 1) Keywords in Page Titles # # 2) Keywords in Domain Names # # 3) Keywords in Page Copy # # 4) Keywords in Headings # # 5) Keywords in Meta description # # 6) Keyword Proximety # # 7) Keywords in Outbound Links # # 8) Page Size # # 9) Words per Page # # 10) Website Size # # and more... # # # # Format: perl rankingfactors.pl 10|100 keyword(s) # ########################################################### use LWP::Simple; use LWP::UserAgent; use HTML::TokeParser; use HTML::TreeBuilder; use File::Path; use Math::Round qw(:all); my $keyphrase = ""; my @googleLinks = ( ); my @googleTitles = ( ); my @yahooLinks = ( ); my @yahooTitles = ( ); my @bingLinks = ( ); my @bingTitles = ( ); #buid keyphrase/keyword if necessary foreach $argnum (1 .. $#ARGV) { $keyphrase = $keyphrase . "$ARGV[$argnum] "; } my $numres = $ARGV[0]; $keyphrase =~ s/^\s+//; $keyphrase =~ s/\s+$//; $keyphrase =~ s/'//g; $keyphrase =~ s/"//g; print "\nStarting.."; #cleanup temp files rmtree( './serptemp', {keep_root => 1} ); print "\n..cleanup done"; #initialize variables initializeKeyVariables($keyphrase, \@googleLinks, \@googleTitles, \@yahooLinks, \@yahooTitles, \@bingLinks, \@bingTitles); #let's store all destination links found on SERPs print "\n..getting SERPs"; getSERPResults($#googleLinks, ...

Get SEO Warrior now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.