Created
November 15, 2011 14:19
-
-
Save thinkhy/1367185 to your computer and use it in GitHub Desktop.
taobao login
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
use strict; | |
use WWW::Mechanize; | |
use HTTP::Cookies; | |
my $argc = @ARGV; | |
if ($argc < 2) | |
{ | |
print "Not enough parameters\n"; | |
print "USAGE: taobao User Password\n"; | |
exit -1; | |
} | |
###go to login page and login. | |
#my $url = 'https://www.google.com/accounts/ServiceLogin?hl=en&service=finance&nui=1&continue=http%3A%2F%2Ffinance.google.com%2Ffinance'; | |
my $url = 'http://wap.taobao.com/login/login.htm'; | |
#my $username = $ARGV[0]; | |
#my $password = $ARGV[1]; | |
my $username = "xulu050810"; | |
my $password = "13439862012lemon"; | |
chomp($username); | |
chomp($password); | |
print "usr: $username\n"; | |
print "psw: $password\n"; | |
print "Working ......\n"; | |
my $mech = WWW::Mechanize->new(); | |
$mech->cookie_jar(HTTP::Cookies->new()); | |
$mech->get($url); | |
$mech->form_number(1); | |
$mech->field(TPL_username => $username); | |
$mech->field(TPL_password => $password); | |
$mech->click(); | |
#Go to the next link, now that we are logged in. | |
#$url = 'http://www.google.com/trends/viz?q=alan+kay&graph=all_csv&sa=N'; | |
$url = 'http://www.google.com/trends/viz?q='.$keyword.'&date=all&geo=cn&graph=all_csv&scale=1&sa=N'; | |
#$url = 'http://finance.google.com/finance/portfolio?action=view&pid=1&pview=pview&output=csv'; | |
$mech->get($url); | |
my $output_page = $mech->content(); | |
my $fh; | |
open $fh, ">$outputfile"; | |
print $fh $output_page; | |
print "Crawler done,make fun!\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment