#!/opt/bin/perl
BEGIN { require "common.pl" }
our ($TXN, %stat, $db_env, $TPB, $db_info, $TODAY);
use common::sense;
use Compress::LZF;
use BDB;
use JSON::XS;
use HTML::Entities;
use Date::Parse;
#############################################################################
our $db_http = table "http";
our $db_torrent = table "torrent";
#############################################################################
#db_compact $db_http, undef, undef, undef, undef, 0, undef;
my $c = $db_http->cursor;
my @del;
#open my $out, "| mbuffer -s4M -m64M | lzma -9 >tpb.json.lzma"
open my $out, "| mbuffer -s4M -m64M >tpb.json"
or die "tpb.json: $!";
sub ashtml($) {
local $_ = shift;
s/^\s+//;
s/\s+$//;
s/\015//g;
utf8::decode $_;
$_
}
sub astext($) {
local $_ = ashtml shift;
#s%.*?%URL<$1>%g;
#s%
%\n%g;
HTML::Entities::decode_entities $_;
utf8::decode $_;
$_
}
sub astime($) {
str2time $_[0]
}
while () {
db_c_get $c, my $key, my $data, BDB::NEXT;
last if $!;
syswrite STDOUT, "\r$key ";
eval {
for (dic_decompress 0, $data) {
my @info;
m%title="More from this category">(.*?)<%s or die "$_: no category";
$info[0] = [split / > /, $1];
$info[1] = $key+0;
m%
(.*?)%s or die "$_: no nfo"; $info[7] = astext $1; my @comments; while ( m%
\s*