<commit_before>#!perl
#This program is free software. You may redistribute it under the terms of the Artistic License 2.0.
package Spot::Snafu v1.3.0;

use 5.012;
use warnings;
use utf8;

use parent qw(Spot);

#$tree
#parses the page to mount it
sub _mount_parse {
	my ($s,$tree) = @_;
	my $img = $tree->look_down( '_tag' => 'img', src => qr'/comics/\d{6}_');
	$s->{$_} = $img->attr($_) for qw(src alt);
	my $navbar = $tree->look_down(class => 'navbar', sub {$_[0]->as_text ~~ qr'Next'});
	my $next = $navbar->look_down(_tag => 'a', sub {$_[0]->as_text ~~ qr'Next'});
	if ($next) {
		$s->{next} = $next->attr('href');
	}
	$s->{$_} = URI->new_abs($s->{$_},$s->{page_url})->as_string() for qw(src next);
	return 1;
}

1;<commit_msg>small improvement for snafu<commit_after>#!perl
#This program is free software. You may redistribute it under the terms of the Artistic License 2.0.
package Spot::Snafu v1.3.0;

use 5.012;
use warnings;
use utf8;

use parent qw(Spot);

#$tree
#parses the page to mount it
sub _mount_parse {
	my ($s,$tree) = @_;
	my $img = $tree->look_down( '_tag' => 'img', src => qr'/comics/\d{6}_');
	$s->{$_} = $img->attr($_) for qw(src alt);
	my $next = $tree->look_down(_tag => 'a', sub {$_[0]->as_text ~~ qr'Next'});
	if ($next) {
		$s->{next} = $next->attr('href');
	}
	$s->{$_} = URI->new_abs($s->{$_},$s->{page_url})->as_string() for qw(src next);
	return 1;
}

1;
{'fraction_non_alphanumeric': 0.23215573179524152, 'fraction_numerical': 0.02090843547224225, 'mean_word_length': 4.359073359073359, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1154885', 'n_tokens_mistral': 605, 'n_tokens_neox': 583, 'n_words': 153}