<commit_before>#!/usr/bin/perl

# start a daemon that crawls all feeds in the database.
# see MediaWords::Crawler::Engine.pm for details.

use strict;

BEGIN
{
    use FindBin;
    use lib "$FindBin::Bin/../lib";
}

use MediaWords::CommonLibs;
use MediaWords::Crawler::Engine;

sub main
{
    my ( $downloads_id ) = @ARGV;

    die unless $downloads_id;

    my $downloads = $dbs->query( "SELECT * from downloads where downloads_id in (?)", $download_id )->hashes;

    my $download = pop @ {$downloads );

    my $db = MediaWords::DB::connect_to_db;

    my $content_ref        = MediaWords::DBI::Downloads::fetch_content( $download );

    my $validate_url = sub { !$dbs->query( "select 1 from downloads where url = ?", $_[ 0 ] ) };

    my $next_page_url = MediaWords::Crawler::Pager->get_next_page_url( $validate_url, $download->{ url }, $content_ref );

    say $next_page_url;
}

main();<commit_msg>Fix compile errors.<commit_after>#!/usr/bin/perl

# start a daemon that crawls all feeds in the database.
# see MediaWords::Crawler::Engine.pm for details.

use strict;

BEGIN
{
    use FindBin;
    use lib "$FindBin::Bin/../lib";
}

use MediaWords::CommonLibs;
use MediaWords::Crawler::Engine;

sub main
{
    my ( $downloads_id ) = @ARGV;

    die unless $downloads_id;

    my $dbs = MediaWords::DB::connect_to_db;

    my $downloads = $dbs->query( "SELECT * from downloads where downloads_id in (?)", $downloads_id )->hashes;

    my $download = pop @{ $downloads };

    my $content_ref = MediaWords::DBI::Downloads::fetch_content( $download );

    my $validate_url = sub { !$dbs->query( "select 1 from downloads where url = ?", $_[ 0 ] ) };

    my $next_page_url = MediaWords::Crawler::Pager->get_next_page_url( $validate_url, $download->{ url }, $content_ref );

    say $next_page_url;
}

main();
{'fraction_non_alphanumeric': 0.1518498067366096, 'fraction_numerical': 0.0022087244616234127, 'mean_word_length': 3.910569105691057, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6975586', 'n_tokens_mistral': 675, 'n_tokens_neox': 628, 'n_words': 157}