Skip to content

Instantly share code, notes, and snippets.

@handlename
Created January 9, 2012 11:47
Show Gist options
  • Save handlename/1582621 to your computer and use it in GitHub Desktop.
Save handlename/1582621 to your computer and use it in GitHub Desktop.
withdraw all requsts on LinkedIn.
#!/usr/bin/env perl
use strict;
use warnings;
use WWW::Mechanize;
my $email = shift;
my $password = shift;
my $mech = WWW::Mechanize->new();
$mech->get('https://www.linkedin.com/uas/login');
$mech->submit_form(
form_id => 'login',
fields => {
session_key => $email,
session_password => $password,
},
);
while (1) {
$mech->get('http://www.linkedin.com/inbox/invitations/sent');
my @links = $mech->find_all_links(
url_regex => qr{displayMBoxItem}
);
last unless @links;
for my $link(@links) {
$mech->get($link->url());
print $link->url() . ', ';
my $withdraw_link = $mech->find_link(url_regex => qr{withdrawInvitation});
if ($withdraw_link) {
$mech->get($withdraw_link->url());
print "withdraw\n";
}
else {
print "\n";
next;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment