As any robot, and passing human, that reads these scribbling will tell you, I’ve been doing one or two experiments with the micro-blogging site du Jour, Twitter. One of the surprises of these is the discovery of a grass-roots movement in individual Jobcentre Plus Offices who use Twitter and, to a lesser extent, Facebook, to try and connect with their ‘customers’.
![small_bucket_list [Picture: movie poster: The Bucket List]](http://blog.zois.co.uk/wp-content/uploads/2011/11/small_bucket_list.jpg)
No, not that kind of list
Twitter isn’t just about organising riots, and these efforts are to be commended. It amuses me that any number of social-commentators, including those on the government payroll, say the same thing, sometimes in large elaborate PDF documents and sometimes in their very own Tweets, but it has been largely left to technologically minded and publicly spirited individuals in individual Jobcentre Offices to do something about it.
Twittering Jobcentre Offices have a happy amateur quality to them. Their posts can be sporadic, the branding inconsistent and not all of them maybe ‘for real’. But I believe the majority are, and there’s now about 150 of them making a sizeable fraction of the 800 or so still active Jobcentre Offices in the country. Their efforts, needless to say are hampered by Government IT, and I help out where I can.
So now I’ve a sizeable Twitter list and I’d like to do something about it. Perhaps note the Twittering Offices’ account names, when my users examine an individual Jobcentre Office. I’ve therefore written a program that probes Twitter lists. It was easy enough to do, and although there are several examples of various levels of antiquity around on the web. I thought I’d dump mine into the Internet Hive-Mind too.
The usual source-code caveats and restrictions apply. As do the usual feedback exhortations.
my @members;
my $cursor = -1;
do {
my $r = $nt->list_members ('JCPM_Feedback',
'jcp',
{'cursor' => $cursor});
foreach my $user (@{$r->{'users'}}) {
push @members, $user->{'screen_name'};
} # foreach
$cursor = $r->{'next_cursor'};
} while ($cursor);
return (@members);
This code, written in Perl, uses Marc Mimm‘s Net::Twitter modules, available through CPAN. The code produces an array of Twitter account names from the @JCPM_Feedback/jcp list. The method list_members returns an array of hash of user-data. One of the items in each is the screen_name, Twitter’s term for the account name, such as is prefaced by an ‘@’ (‘@JCPM_Feedback’, for example). This is the datum that we’re interested in, on this occasion. The trick with all of this, is that you get this stuff in page-like chunks. You therefore have to run over the entire dataset using an entity termed a ‘cursor’. This value is magically maintained by the list_members method and will be set to zero (or false) once all the data has been returned. It initially has to be set to ‘-1′.
To use this one needs to set up the $nt object. In these days of OAuth, you need to set-up authentication tokens on the Twitter development site and then use them thusly.
my $nt = Net::Twitter->new
(
traits => [qw{OAuth API::Lists API::REST WrapError}],
consumer_key => "secret, get your own",
consumer_secret => "secret, get your own",
access_token => "secret, get your own",
access_token_secret => "secret, get your own"
);
Naturally, one could make this code more generalised, but I’ll leave that as an exercise for the reader.
Returning, finally, to Jobcentres. My numbers and assessment of their quantity is purely based on those that appear on-line, in Twitter form, or through the Jobseekers Direct web-site. I’m aware that in major centres there are a number of Jobcentre Plus offices that are involved in working with ‘customers’ off-line. So the real number of Jobcentres may be considerably more.