воскресенье, 24 мая 2009 г.

yahoo backlinks parser

#!/usr/bin/perl

use LWP::Simple;

# Content
my $content;
my @tsv;

# Main entry requires one argument or more
if ($ARGV[0]) {
# search for URL
local $needle = $ARGV[0];

# checking http:// prefix
unless ($needle =~m#http://\S+#i) {
$needle = "http://".$needle;
}

# processing
$content = get "http://siteexplorer.search.yahoo.com/advtsv?p=${needle}&bwm=i&bwmf=&bwmo=";

# settings lines
@tsv = split '\n', $content;

# parsing TSV
$i = 0;
foreach my $line (@tsv) {
if ($i > 1) {
($title, $url, $size, $format) = split '\t', $line;

# print ONLY URLS
print "$url\n";
}
$i++;
}
} else {
# show usage tip
print "Usage:\nperl $0 URL\n";
}


# perl yahoo-backs.pl mysite.com

Комментариев нет:

Отправить комментарий