use URI::Escape;
use WWW::Mechanize;
+use HTTP::Cookies;
use IO::Dir;
use IO::File;
use vars qw($DEBUG);
my $failure = 0;
my $m = WWW::Mechanize->new();
+$m->cookie_jar(HTTP::Cookies->new());
+$m->cookie_jar()->set_cookie(1,'age_verified','42','/','www.1000manga.com');
+# use Data::Dumper;
+# print STDERR Dumper($m->cookie_jar());
for my $manga (@manga_to_get) {
# see if the manga exists
mm_get($m,$options{onemanga}.'/'.$manga);
my $chapter_long = $chapter =~ /\./ ? join('.',map {sprintf'%04d',$_} split /\./,$chapter) : sprintf('%04d',$chapter);
if (! -d "$manga/$chapter_long") {
print $chapter_link->url(),qq(\n);
- mkdir("$manga/$chapter_long");
mm_get($m,$chapter_link->url_abs());
- my $link = $m->find_link(text_regex => qr{Begin reading});
+ my $link = $m->find_link(text_regex => qr{Begin [Rr]eading});
+ if (not defined $link) {
+ #print $m->content();
+ my $temp = $m->find_link(text_regex => qr{Read.*at.*1000manga\.com});
+ mm_get($m,$temp->url_abs());
+ #print $m->content();
+ $link = $m->find_link(text_regex => qr{Begin [Rr]eading});
+ }
mm_get($m,$link->url_abs());
+ # print $link->url_abs();
+ # print $m->content();
+ mkdir("$manga/$chapter_long");
while ($m->uri() =~ m{\Q$chapter\E/(\d\d[^\/]*)/?$}) {
my $image = $m->find_image(alt_regex => qr{Loading\.+\s+(media|img)});
my $next_link = $m->find_link(url_regex => qr{\Q$manga_escaped\E/\Q$chapter\E/(\d\d[^\/]*)});