我实际上是在尝试学习perl代码,而且我的机械化最后一个代码遇到了一些问题。 我只想创建一个机器人登录我最喜欢的网站。 我已经用Priceminister和facebook做了,但是我用spotify阻止了。
CMD回复我:
There is no form with the requested fields at C:/Perl64/lib/WWW/Mechanize.pm line 1001.
但是页面的源代码中有一个表单。 (网页上有验证码,是问题吗?)
我的代码:
use Browser::Open qw( open_browser );
use WWW::Mechanize;
use HTTP::Cookies;
use Time::HiRes;
use strict;
use warnings;
system('cls');
my $cookies= 'cookies.txt'; #your cookies file path here
my $Mail = '<MyMail>';
my $password = '<MyPassword>';
my $mech = WWW::Mechanize->new( cookie_jar => HTTP::Cookies::Netscape->new( file => $cookies ) );
$mech->agent_alias( 'Windows Mozilla' );
my $ftp = "https://accounts.spotify.com/fr-FR/login?continue=https:%2F%2Fwww.spotify.com%2Ffr%2Faccount%2Foverview%2F";
$mech->get ($ftp);
print "\n";
print "\n";
print "\n";
print $mech->uri, "\n", "\n";
print $mech->forms, "\n", "\n";
print "\n";
print "\n";
print "\n";
$mech->submit_form(
with_fields => {
username => $Mail,
password => $password
}
);
print $mech->uri, "\n", "\n";