summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-11 10:20:36 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-07-11 10:20:36 +0800
commitc8046cee8867d4554623ad58eaf9f98fc60c1c5a (patch)
tree075ee543fe4c6ea6dec271cd1ef82e2c4d9e06fd
parent4e38e38c07256bef837af823445de794c3702889 (diff)
downloadpttbbs-c8046cee8867d4554623ad58eaf9f98fc60c1c5a.tar
pttbbs-c8046cee8867d4554623ad58eaf9f98fc60c1c5a.tar.gz
pttbbs-c8046cee8867d4554623ad58eaf9f98fc60c1c5a.tar.bz2
pttbbs-c8046cee8867d4554623ad58eaf9f98fc60c1c5a.tar.lz
pttbbs-c8046cee8867d4554623ad58eaf9f98fc60c1c5a.tar.xz
pttbbs-c8046cee8867d4554623ad58eaf9f98fc60c1c5a.tar.zst
pttbbs-c8046cee8867d4554623ad58eaf9f98fc60c1c5a.zip
better formatting
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1043 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/udnnews.pl14
1 files changed, 6 insertions, 8 deletions
diff --git a/util/udnnews.pl b/util/udnnews.pl
index 1c49dc8c..21e3262c 100644
--- a/util/udnnews.pl
+++ b/util/udnnews.pl
@@ -22,7 +22,7 @@ foreach( @titles ){
postout({brdname => 'udnnews',
title => strreplace(FormatChinese($_->[1])),
owner => 'udnnews.',
- content => getudnnewscontent("http://www.udn.com/NEWS/FOCUSNEWS/$_->[0]")});
+ content => getudnnewscontent("http://www.udn.com/NEWS/FOCUSNEWS/$_->[0]", $_)});
}
sub strreplace
@@ -34,19 +34,17 @@ sub strreplace
return $str;
}
-sub getudnnewscontent($)
+sub getudnnewscontent($$)
{
- my($url) = @_;
+ my($url, $title) = @_;
my($buf, $content, $ret);
$buf = `$LYNX -source '$url'`;
($content) = $buf =~ m|<!-- start of content -->(.*?)<!-- end of content -->|s;
# ($content) = $buf =~ m|<p><font color="#CC0033" class="text12">(.*?)<tr valign="top">|s if( !$content );
- $content =~ s/<br>/\n/g;
$content =~ s/<p>/\n/gi;
$content =~ s/<.*?>//g;
$content =~ s/\r//g;
- $content =~ s/\n\n\n/\n\n/g;
- $content =~ s/\n\n\n//g;
+ $content =~ s/\n+/\n/gs;
$content = strreplace($content);
undef $ret;
foreach( split(/\n/, $content) ){
@@ -54,8 +52,8 @@ sub getudnnewscontent($)
$ret .= FormatChinese($_, 60). "\n" if( $_ );
}
return
- "作者: udnnews.(聯合新聞) 看板: udnnews\n".
- "標題: \n".
+ "作者: udnnews.(聯合新聞網) 看板: udnnews\n".
+ "標題: $title\n".
"時間: 即時\n".
"※ [轉錄自 $url ]\n\n$ret\n\n".
"--\n\n 聯合新聞網 http://www.udn.com/ 獨家授權批踢踢實業坊 ".