rss2html/scrubber_test

26 lines
637 B
Plaintext
Raw Normal View History

#!/usr/bin/perl
# missing: Sanitize html
use strict;
use warnings;
use Rss2Html::Scrubber;
use DBI;
my $dbh = DBI->connect("dbi:SQLite:dbname=rss2html.sqlite", "", "");
$dbh->{sqlite_unicode} = 1;
my $scrubber = Rss2Html::Scrubber->new();
my $item
= $dbh->selectrow_hashref(
"select link, items.title as item_title, content, items.id as item_id
from items
where item_id=?
",
{ Slice => {} }, $ARGV[0]);
my $content = $scrubber->scrub($item->{content});
open my $fh1, '>:encoding(UTF-8)', "$ARGV[0].raw.html";
print $fh1 $item->{content};
open my $fh2, '>:encoding(UTF-8)', "$ARGV[0].scrubbed.html";
print $fh2 $content;