Commit 5028946dd6acf682321e7165d0f067fe9cb99cd3

nao exibe senha no terminal e adicionado opção de limpar cookie
legendas.tv
(32 / 7)
  
55use HTTP::Cookies;
66use WWW::Mechanize;
77use Getopt::Euclid;
8use Term::ReadPassword;
89
910use constant COOKIE => "$ENV{HOME}/.legendas.tv.cookie";
1011
1818
1919use constant SELECT_LANG => PT_BR;
2020
21sub clean {
22 my $cookie = shift;
23 say ' * limpando cookie';
24 $cookie->clear;
25}
26
2127my $cookie = HTTP::Cookies->new(file => COOKIE, autosave => 1);
28
2229my $logged = 0;
2330$cookie->scan(sub {
2431 my ($key, $expires) = ($_[1], $_[8]);
3838$browser->get('http://legendas.tv');
3939
4040unless ($logged) {
41 say ' * entre com seu login e password';
41 say ' * entre com seu login e senha';
4242 print ' login: '; chomp(my $LOGIN = <STDIN>);
43 print ' password: '; chomp(my $PASSWORD = <STDIN>);
43 my $PASSWORD = read_password(' senha: ');
4444 say ' * logando';
4545 $browser->submit_form(
4646 form_name => 'form1',
7171}
7272else {
7373 say " * nenhuma legenda encontrada!";
74 clean($cookie) if defined $ARGV{'-c'};
7475 exit -1;
7576}
7677
8787 chomp(my $n = <STDIN>);
8888 last if $n eq 'q';
8989
90 say "\n * baixando legenda $film[$n]->{id}";
90 say "\n * baixando legenda $film[$n]->{release}";
9191 $browser->get("http://legendas.tv/info.php?d=$film[$n]->{id}&c=1");
9292
9393 say ' * arquivo ' . $browser->response->filename . ' salvo';
9797 chomp($response = <STDIN>);
9898}
9999
100clean($cookie) if defined $ARGV{'-c'};
101
100102exit 0;
101103
102104__END__
103105
104106=head1 NAME
105107
106legendas.tv - pesquisa, exibe, e baixa legendas do legendas.tv
108legendas.tv - pesquisa e baixa legendas do legendas.tv
107109
108110=head1 VERSION
109111
1100.01
1120.02
111113
112114=head1 USAGE
113115
114legendas.tv <filme>
116legendas.tv <filme> [options]
115117
116=head1 REQUIRED ARGUMENT
118=head1 REQUIRED ARGUMENTS
117119
118120=over
119121
127127 filme.type: string, length(filme) > 2
128128
129129=back
130
131=head1 OPTIONS
132
133=over
134
135=item -c
136
137Limpa o cache
138
139=back
140
141=head1 TODO
142
143Exibir legendas das proximas paginas quando houver paginação
130144
131145=head1 AUTHOR
132146