updated git and svn scripts
[xrzperl.git] / sinabook_h2t
blobfb1a2ffebbee01cfa4ebba2686f0a8ca3df34c48
1 #!/usr/bin/perl -w
2 ###APPNAME: sinabook_h2t
3 ###APPAUTHOR: duel
4 ###APPDATE: Wed Mar 12 01:44:35 2008
5 ###APPVER: 0.1
6 ###APPDESC: convert html file download from book.sina.com.cn to plain-text
7 ###APPUSAGE: [html file]
8 ###APPEXAMPLE: sinabook_h2t foo.htm\n\tcat foo.htm | sinabook_h2t
9 use strict;
10 $ARGV[0]="-h" unless(@ARGV);
11 foreach(@ARGV){
12 exit(system("plhelp",$0,@ARGV)) if($_ eq "-h" || $_ eq "--help");
15 my $processor="htm2txt";
16 my $rootid = '-s "<font id=\"zoom\" class=f14><p>" -e "<table align=right><tr><td>"';
17 #my $rootid = '-r contTxt,artibody,article -s "<div id=article>" -e "返回目录"';
18 if(@ARGV) {
19 open FI,"-|","iconv -f gb2312 -t utf8 '$ARGV[0]' | $processor $rootid";
21 else {
22 open FI,"-|","$processor $rootid";
24 while(<FI>) {
25 s/^.*(新浪|相关链接|读书频道).*$//g;
26 print;
28 close FI;