Saturday, January 24, 2009

Retrieve the search rank for your blog automatically

I was reading the latest article over at Pretty Your Blog yesterday and it gave me an idea for a first script. The FileInfo program that I wanted to present is already written and I may come back to it later. The RankSearch project that I have in mind will be written from the ground up so you'll be able to monitor the progress as I crawl towards completion. I hope you'll pitch in as well!

RankSearch: The need
Kelly wrote in Pretty Your Blog:
I ran another (unofficial) experiment; I did a google search for frugal blog. And the result? Almost Frugal was on the 13th page of search results.
It is very likely that Kelly clicked on the next link at the bottom of each Google page until she found her blog's reference (by the way, if you are interested in improving your blog, you may want to visit Pretty Your Blog often :).
What if we could write a Perl script that automatically returns the Google rank based for any URL on a given keyword? That's the idea behind RankSearch.pl

RankSearch: The specifications
The script will have to be as generic as possible and would take 3 input parameters:
- Search engine URL (eg: "www.google.com" or "www.yahoo.com")
- URL of the blog you want to check the ranking for (eg: "almostfrugal.com")
- The search criteria you are investigating (eg: "frugal blog")

The output result will be a simple message of the type:
almostfrugal.com is ranked 7th on the google search engine for the "frugal blog" criteria.

It will run on Windows and Linux environments
Do you see anything else to add?

And here is the template for it:
#!/usr/bin/perl -w
# ----------------------------------------
# File : RankSearch.pl
# Author : DLP
# Date : January 24th 2009
# Object : Looks in a search engine what is the rank
# for a given website and a given keyword
# Input : - Search engine URL, eg. "www.google.com"
# - URL of website to monitor
# - Search expression to investigate
# Bugs : None
# To do : - Read input and store in script variable
# - Launch http request
# - Read html result
# - Analyse result and display website rank
# ----------------------------------------
use strict;

my $PROG_NAME = "RankSearch";
my $VERSION = "v0.0.1";
my $PROG_DATE = "January 24th 2009";

print "$PROG_NAME $VERSION from $PROG_DATE.\n";

__END__
Jan 24 2009: first version of RankSearch

French word of the day:
"économe": frugal

New posts:
  • Our first Perl program - Part II: parsing the Perl command line
  • More about CPAN
  • Our first Perl program - Part III: Launch a HTTP request
  • How to install Google Analytics on your Blogger blog
  • Our first Perl program - Part IV: Read results from a HTML page
  • Perl help resources
  • Our first Perl program - Part V: Result analysis
  • Our first Perl program - Part VI: Add a GUI interface

5 comments :

  1. Before you decide to name your program 'SearchRank' I'd like to bring to your attention that SearchRank is the federally registered trademark of my company, a trademark that we defend vigorously.

    I'd therefore advise you to rethink what you will call your project as it would violate our trademark.

    Please email me at legal at searchrank.com to advise what your response is so I know what my next actions are.

    ReplyDelete
  2. This is funny which part of the searchrank is trademarked? The search or the rank?

    You can not trademark it and if you did, you have no chance whatever.

    By the way, seen several such modules on CPAN.

    Moshe
    http://www.web-app.net

    ReplyDelete
  3. David,

    first off, thanks for visiting DamienLearnsPerl!
    I hope that you will come back and comment on more posts.
    Secondly, it was never my intention to take advantage of your company's name to boost my traffic. Therefore, I will remove all mentions to SearchRank.pl from any posts I have written.

    ReplyDelete
  4. @Moshe - Neither 'search' nor 'rank' but the two words together (SearchRank). And if you don't believe it is trademarked, see for yourself - http://tarr.uspto.gov/servlet/tarr?regser=serial&entry=78052519.

    @Damien - Thanks for your cooperation.

    ReplyDelete
  5. "to advise what your response is so I know what my next actions are..."

    What, litigation? You've got to be kidding me...that was an extremely threatening comment to leave on a guy's blog who is just trying to teach others about PERL.

    I certainly know where I won't be taking my business for search engine help.

    ReplyDelete