Created
January 9, 2012 11:47
-
-
Save handlename/1582621 to your computer and use it in GitHub Desktop.
withdraw all requsts on LinkedIn.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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