Wouldn't you know it. Bitcoins.lc just change their authentication, preventing the rewards subroutine from logging in. The two lines with "_csrf_protect_token" need to change to "_csrf_token" to fix this. If they change it again, look at the login page's source and pick out the new token name, from the login section.
Here is the code again with the changes.
sub bitcoinslc_rewards {
print "parsing bitcoin.lc rewards\n";
my $url1='https://www.bitcoins.lc/';
my $url2='https://www.bitcoins.lc/transactions';
my $pool=$pools{"bitcoins-lc"};
$pool->{rounds_time}=shared_clone({}) unless $pool->{rounds_time};
foreach my $account (values %{$accounts{"bitcoins-lc"}}) {
$_=wget($url1, "--keep-session-cookies --save-cookie bitcoins-lc-cookie.txt");
if (!$_){
print "error: unable to fetch bitcoins-lc login page $url1\n";
return;
}
m{.* name="_csrf_token" value="(\w.*)"};
my $token=$1;
my $ok=($token=~/^[a-z0-9]+$/);
if ($ok){
$_=wget($url1, "'--post-data=_csrf_token=$token&action=login&email=$account->{web_user}&password=$account->{web_pass}&login=Proceed'", "--load-cookies bitcoins-lc-cookie.txt", "--keep-session-cookies --save-cookie bitcoins-lc-cookie2.txt");
$ok=!!$_;
}
if ($ok){
$_=wget($url2, "--load-cookies bitcoins-lc-cookie2.txt");
$ok=!!$_;
}
my @lines;
if ($ok){
@lines=split/\n/;
$ok=@lines; # puts the number of lines in $ok
}
if (!$ok){
print "error: cannot login into/parse stats page for bitcoin-lc using account $account->{name}\n";
return;
}
@lines = grep { /Your Transactions/ .. /div id="rightcol"/ } @lines;
if (!@lines) {
print "error: no lines matched between Your Transactions and div id=rightcol; code needs changed!\n";
return;
}
my @new_rounds;
my $blockid = 0;
my $date;
my $shares = 0;
my $reward = 0;
my $epoch = 0;
foreach (@lines){
if (/Received Block (\d+)
- (.*)<\/span>/) {
$blockid = $1;
$date = $2;
$date =~ s/ (\d\d?) (...) / $2 $1 /;
$epoch=qx(date -d '$date' +%s); chomp $epoch;
}
if (/Based upon (\d+) valid shares/) {
$shares = $1;
next if (!$blockid);
}
if (/\+([\d.]+)/) {
$reward = $1;
if ($blockid) {
#print "Debug: block $blockid, date '$date', epoch '$epoch', shares $shares, amount $reward\n";
$ok=($blockid=~/^[a-z0-9]+$/ and $reward=~/^\d+\.\d+$/ and $epoch=~/^\d+$/ and $shares=~/^\d+$/);
if (!$ok){
print "error parsing stats page for bitcoins-lc using account $account->{name}: line=$_\n";
foreach my $round (@new_rounds){
delete $account->{rounds}->{$round};
}
return;
}
my $round=$pool->{rounds_time}->{$epoch};
if (!$round){
$round=guess_round($epoch, $pool, $epoch);
next if !$round;
$pool->{rounds}->{$round}=shared_clone({time => $epoch, shares => $shares});
$pool->{rounds_time}->{$epoch} = $round;
}
if (!$account->{rounds}->{$round}){
$account->{rounds}->{$round}=shared_clone({earned => $reward, shares_web => $shares});
push @new_rounds, $round;
}
# Then reset data
$blockid = $shares = $reward = $epoch = 0;
$date = "";
} else {
next;
}
}
last if (/Recent Transactions/);
}
consolidate_rounds($account, @new_rounds);
}
}