Subject: | Login fails; login form was changed 2008-04-10, patch included |
Date: | Fri, 11 Apr 2008 13:22:24 +0100 |
To: | bug-www-myspace [...] rt.cpan.org |
From: | Steven Chamberlain <steven [...] pyro.eu.org> |
Hi,
The names of the login form inputs changed (yesterday, I believe) from:
ctl00$Main$SplashDisplay$ctl00$Email_Textbox
to:
ctl00$ctl00$Main$cpMain$SplashDisplay$ctl00$Email_Textbox
and likewise, for the password textbox and login button.
WWW::Myspace (at least the latest SVN, R566) is currently unable to
login as a result of this change. I have attached a patch which adds
support for this new form as well supporting the old ones (in case it
ever changes back). I also tidied up the comments in the _try_login
function.
I hope this helps!
Regards,
--
Steven Chamberlain
steven@pyro.eu.org
Index: lib/WWW/Myspace.pm
===================================================================
--- lib/WWW/Myspace.pm (revision 566)
+++ lib/WWW/Myspace.pm (working copy)
@@ -629,29 +629,46 @@
if ( $tries_left ) { $tries_left--; return if ( $tries_left ) < 1; }
$tries_left = 20 unless defined $tries_left;
- # Submit the login form. They have two different ones, so if we see indication of
- # the ASP form (new as of late Jun 2007), use it, otherwise use the CFM version.
- # 9/17/07 - they changed from "ctl01" to "ctl00", so we check for both in case
- # they go back and forth.
+ # Detect which login form is in use, and submit it.
my $submitted="";
$self->get_page( 'http://www.myspace.com/' );
if ( $self->current_page->decoded_content =~
- /ctl00\$Main\$SplashDisplay\$ctl00\$Email_Textbox/io )
+ /ctl00\$ctl00\$Main\$cpMain\$SplashDisplay\$ctl00\$Email_Textbox/io )
{
+ # 2008-04-11 -- they added an extra ctl00$ and cpMain$ to the names of
+ # the login form inputs
$submitted = $self->submit_form( {
# page => 'http://www.myspace.com/',
form_name => 'aspnetForm',
- fields_ref => { 'ctl00$Main$SplashDisplay$ctl00$Email_Textbox' => $self->account_name,
- 'ctl00$Main$SplashDisplay$ctl00$Password_Textbox' => $self->password,
- # '__EVENTTARGET' => 'ctl00$Main$SplashDisplay$ctl00$Login_ImageButton',
+ fields_ref => { 'ctl00$ctl00$Main$cpMain$SplashDisplay$ctl00$Email_Textbox' => $self->account_name,
+ 'ctl00$ctl00$Main$cpMain$SplashDisplay$ctl00$Password_Textbox' => $self->password,
+ # '__EVENTTARGET' => 'ctl00$ctl00$Main$cpMain$SplashDisplay$ctl00$Login_ImageButton',
# '__EVENTARGUMENT' => '',
},
action => 'http://secure.myspace.com/index.cfm?fuseaction=login.process',
# no_click => 1,
} ) ;
} elsif ( $self->current_page->decoded_content =~
+ /ctl00\$ctl00\$Main\$cpMain\$SplashDisplay\$ctl00\$Email_Textbox/io )
+ {
+ # 2007-09-17 -- they changed from "ctl01" to "ctl00". If this form is
+ # not found we check for the "ctl01" form in case they go back and
+ # forth.
+ $submitted = $self->submit_form( {
+# page => 'http://www.myspace.com/',
+ form_name => 'aspnetForm',
+ fields_ref => { 'ctl00$Main$SplashDisplay$ctl00$Email_Textbox' => $self->account_name,
+ 'ctl00$Main$SplashDisplay$ctl00$Password_Textbox' => $self->password
+ # '__EVENTTARGET' => 'ctl00$ctl00$Main$cpMain$SplashDisplay$ctl00$Login_ImageButton',
+ # '__EVENTARGUMENT' => '',,
+ },
+ action => 'http://secure.myspace.com/index.cfm?fuseaction=login.process',
+ # no_click => 1,
+ } ) ;
+ } elsif ( $self->current_page->decoded_content =~
/ctl00\$Main\$SplashDisplay\$ctl01\$Email_Textbox/io )
{
+ # Late 2007-06 -- an ASP form appears alongside the CFM form
$submitted = $self->submit_form( {
# page => 'http://www.myspace.com/',
form_name => 'aspnetForm',
@@ -664,6 +681,7 @@
# no_click => 1,
} )
} else {
+ # The old CFM form
my $btn_name = $self->current_page->decoded_content =~
/ctl00\$Main\$SplashDisplay\$ctl00\$loginbutton/ ?
'ctl00$Main$SplashDisplay$ctl00$loginbutton' :