Created
January 12, 2010 03:59
-
-
Save yaotti/274887 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use WWW::Mechanize; | |
use Config::Pit; | |
my $mech = WWW::Mechanize->new(); | |
my $login_url = "http://lang-8.com/login"; | |
my $response = $mech->get($login_url); | |
my ( $mail, $password ) = do { @{ pit_get("lang-8.com") }{qw/mail password/} }; | |
my $r = $mech->submit_form( | |
form_number => 2, | |
fields => { | |
username => $mail, | |
password => $password | |
} | |
); | |
die "can't login to $login_url" unless $mech->success; | |
my $post_url = "http://lang-8.com/journals/edit"; | |
$mech->get($post_url); | |
my $subject = "test"; | |
my $body = "test post"; | |
$r = $mech->submit_form( | |
form_number => 2, | |
fields => { | |
'draft[lang_num]' => 2, # English | |
'draft[subject]' => $subject, | |
'draft[body]' => $body, | |
'draft[pf_int]' => 1, # private | |
'post_to_twitter' => 0, # not post to twitter | |
}, | |
button => 'publish' | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment