perl5

openssl + Net::SSLeay

use strict;
use warnings;
use utf8;
binmode STDOUT, ":utf8";
use feature qw/say/;
use LWP::UserAgent;
use Encode;

my $ta_url = "https://13dl.me/home/";
my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/5.0 (Android; Linux armv7l; rv:5.0) Gecko/20110615 Firefox/5.0 Fennec/5.0");
my $flag = 1;
my $count = 0;

while($flag == 1){
    $flag = 0;
    my $response = $ua->get($ta_url);
    die $response->status_line if !$response->is_success;
    $ta_url = "";

    my $body = $response->decoded_content;
    my $temp = "";
    my $temp2 = "";

    while ($body =~ /\<a\s.*?title\=\"(.*?)\"/g) {
        if ($1 =~ /^Next/) {
            if ($body =~ /\<a\stitle\=\"Next\"\shref\=\"(.*?)\"/) {
                unless( $temp2 eq $1) {
                    $temp2 = $1;
                    $ta_url = "https://13dl.me/list/popular".$1;
                    $flag = 1;
                }
            }
        }
        elsif ($temp ne $1 && !($1 =~ /^Home/) && !($1 =~ /^Popular Manga/) && !($1 =~ /^Newest/) && !($1 =~ /^Page/) && !($1 =~ /^Prev/)) {
            $count++;
            $temp = $1;
            say $count . " " . $temp;
        }
    }
    undef($body);
    undef($temp);
    undef($temp2);
}

using system-call cURL as 'https' request and returns stdout as a string

example:

my $gr_text = system('curl -s '.$location.' | grep "datetime"');
print $gr_text;

https://perlmaven.com/simple-way-to-fetch-many-web-pages

qx{}
https://perldoc.perl.org/perlop#Quote-Like-Operators

use strict;
use warnings;
use utf8;
binmode STDOUT, ":utf8";
use feature qw/say/;
#use LWP::UserAgent;
use Encode 'decode';

my $ta_url = "https://13dl.me/home/";
#my $ua = LWP::UserAgent->new;
#$ua->agent("Mozilla/5.0 (Android; Linux armv7l; rv:5.0) Gecko/20110615 Firefox/5.0 Fennec/5.0");

my $flag = 1;
my $count = 0;

while($flag == 1){
    $flag = 0;
    #    my $response = $ua->get($ta_url);
    #    die $response->status_line if !$response->is_success;
    my $syscommand = qx{curl -s $ta_url};
    $ta_url = "";
    my $body = decode('UTF-8',$syscommand);
    undef($syscommand);

    #    my $body = $response->decoded_content;
    my $temp = "";
    my $temp2 = "";

    while ($body =~ /\<a\s.*?title\=\"(.*?)\"/g) {
        if ($1 =~ /^Next/) {
            if ($body =~ /\<a\stitle\=\"Next\"\shref\=\"(.*?)\"/) {
                unless( $temp2 eq $1) {
                    $temp2 = $1;
                    $ta_url = "https://13dl.me/list/popular".$1;
                    $flag = 1;
                }
            }
        }
        elsif ($temp ne $1 && !($1 =~ /^Home/) && !($1 =~ /^Popular Manga/) && !($1 =~ /^Newest/) && !($1 =~ /^Page/) && !($1 =~ /^Prev/)) {
            $count++;
            $temp = $1;
            say $count . " " . $temp;
        }
    }
    undef($body);
    undef($temp);
    undef($temp2);
}
Edit
Pub: 14 May 2022 09:30 UTC
Edit: 26 May 2022 01:58 UTC
Views: 303