#!/usr/bin/perl -w use strict; use WWW::Mechanize; &main(); sub main { my $throttle = 10; my $mech = WWW::Mechanize->new(); $mech->agent_alias( 'Windows IE 6' ); ## get our list of keywords from the dictionary file open (KEYWORDS, '/Users/adam/Documents/Perl/dictionary.txt'); my @tags; while () { my $tag = $_; chomp($tag); push(@tags,$tag); } close (KEYWORDS); my $url; my $result; ## grab del.icio.us url for each tag foreach my $tag (@tags) { print "$tag\n"; $url = "http://del.icio.us/tag/" . $tag . "?setcount=100"; print "$url\n"; $mech->get( $url ); $result = $mech->content; &process($result, $mech); sleep($throttle); } } ## scrape del.icio.us for urls sub process { my $result = $_[0]; my $mech = $_[1]; my @urls; my @links = $mech->links(); foreach my $link (@links) { if ($link->url() =~ /^http/g && $link->url() !~ /del.icio.us/g) { print $link->url() . "\n"; push(@urls,$link->url()); } } &ref_spam(@urls); } ## hit up each site with our url to promote as the referer sub ref_spam { my @urls = $_[0]; my $mech = $_[1]; my $promote_url = "http://www.test.com"; $mech->add_header( Referer => $promote_url ); foreach my $url (@urls) { $mech->get($url); } }