2 ###APPNAME: htm2txt_adult168
3 ###APPAUTHOR: xiaoranzzz
4 ###APPDATE: Tue Mar 11 05:03:49 2008
6 ###APPDESC: convert html file download from adult168.com to text
7 ###APPUSAGE: [htmlfile...]
8 ###APPEXAMPLE: htm2txt_adult168 booksrc/1.shtml
11 use HTML
::TreeBuilder
;
12 use lib
$ENV{XR_PERL_MODULE_DIR
};
13 use MyPlace
::Script
::Usage qw
/help_required/;
15 exit 0 if(help_required
($0,@ARGV));
16 use MyPlace
::Filename qw
/get_uniqname/;
18 use MyPlace
::HTML
::Convertor
;
27 push @flist,"/dev/stdin";
32 foreach my $fn (@flist) {
38 next unless(-f
$fn or $fn="/dev/stdin");
39 open FI
,"-|","cat '$fn' | gb2utf" or die("$!\n");
42 $title = get_title
($_) unless($title)
49 $title =~ s/\.(html|htm)$//;
55 $dst = get_uniqname
($title,".txt");
56 print STDERR
"[$index/$count]$fn -> $dst ...";
57 if(! open FO
,">",$dst) {
58 print STDERR
("\n$!\n");
61 print FO
$title,"\n","\n";
63 my @dst=@
{text_from_string
(\
@src,undef,undef,["zoom"],undef)};