About Adam Taylor...

I am a student, blogger, lazy entrepreneur....


I write about: Analytics, blogging, search engine optimisation and social media marketing.


Find out more...

Archive: April 2008

A little script for you…

A fair few weeks ago I wanted to see if I could still code any Perl, which I’m glad to say [I think] I can, so I decided to port a little php script to Perl. For some reason I can’t access the original post/script anymore, but it was deStone’s delicious referral spammer - if you can get the link to work, your computer is better than mine!

So all it does is load up a list of keywords, go through each of the associated tag pages and then visit each site with any refer URL you want to promote.

It’s pretty pointless, I can’t imagine too many webmasters still look at old school stats packages, but I could be wrong.

#!/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);
	}

}

[I’m aware it displays a bit messed up - you’ll have to deal with it.]

This no longer works for me ‘cos I’m in halls and would need to add proxy support, but I think it worked ;)!

Play around with it if you want; I’m not advocating any particular uses for it or being massively helpful on how to run it - deliberately.

I’m sure it could be improved upon - to use proxies, threads or made more OO but I only hacked it up to check I could still code Perl.

Here’s the dictionary file and the perl script (rename to .pl).

Pimping Myself Out

Sorry I haven’t posted in a while, feel like saving myself until I have something unique to say, anyway I need a job in July so I thought I’d pimp myself out on my blog for a start.

So briefly:

I spent a year as a ‘Junior Web Developer’ at a UK search conversion agency in London, where I was taught Perl, MySQL, Linux etc.

I’m currently a first year undergraduate student at the University of Durham studying Computer Science where we’re being taught Java, SQL, computer systems and lots of maths.

I’m also interested in analytics, blogging, social media and search engine optimisation.

I can work in either London, Newcaslte/Durham or around the Bath area.

I’m not hugely hopefully about getting a decent job just for a month (especially just through my blog) but we’ll see. It can only be for July because I’m at university until the end of June and then I’m going to go interrailing around Europe in August.

If anyone wants anymore information just drop me an email using the contact form.

Tamar Goes To Town 121 Tamar Goes To Town 120 Tamar Goes To Town 119 Tamar Goes To Town 118 Tamar Goes To Town 117 Tamar Goes To Town 116 Tamar Goes To Town 115 Tamar Goes To Town 114 Tamar Goes To Town 113