summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-08 00:59:36 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-08 00:59:36 +0800
commit3205d13594dabb6ce34c604be958de3d23aa3618 (patch)
tree4322ef34e46944604ee68c23921f7fd49234acf6
parent9e0b2ea45c1e12487b0e1adacff2374e1abc3698 (diff)
downloadpttbbs-3205d13594dabb6ce34c604be958de3d23aa3618.tar
pttbbs-3205d13594dabb6ce34c604be958de3d23aa3618.tar.gz
pttbbs-3205d13594dabb6ce34c604be958de3d23aa3618.tar.bz2
pttbbs-3205d13594dabb6ce34c604be958de3d23aa3618.tar.lz
pttbbs-3205d13594dabb6ce34c604be958de3d23aa3618.tar.xz
pttbbs-3205d13594dabb6ce34c604be958de3d23aa3618.tar.zst
pttbbs-3205d13594dabb6ce34c604be958de3d23aa3618.zip
* remove udnnews.pl. it is broken and doesn't work many years.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4521 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/Makefile2
-rw-r--r--util/udnnews.pl119
2 files changed, 1 insertions, 120 deletions
diff --git a/util/Makefile b/util/Makefile
index 0af19f73..82a26302 100644
--- a/util/Makefile
+++ b/util/Makefile
@@ -42,7 +42,7 @@ PROGS= ${CPROG_WITH_UTIL} ${CPROG_WITHOUT_UTIL} ${CPP_WITH_UTIL}\
openticket.sh stock.sh topsong.sh weather.sh \
stock.perl weather.perl toplazyBM.sh \
dailybackup.pl tarqueue.pl waterball.pl filtermail.pl \
- getbackup.pl udnnews.pl rebuildaloha.pl
+ getbackup.pl rebuildaloha.pl
LDLIBS+=$(SRCROOT)/common/bbs/libcmbbs.a \
$(SRCROOT)/common/sys/libcmsys.a \
diff --git a/util/udnnews.pl b/util/udnnews.pl
deleted file mode 100644
index fd02efc3..00000000
--- a/util/udnnews.pl
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/perl
-#
-# 請註意!
-# 本程式版權屬於 PttBBS ,
-# 但只表示您可以公開免費取得本程式,
-# 並不表示您可以使用本程式.
-#
-# 本程式將直接連至 udnnews網站取得當前新聞,
-# 而新聞內容的版權是屬於 聯合新聞網 所有.
-# 亦即, 您若沒有聯合新聞網之書面授權,
-# 您並「不能」使用本程式下載該網新聞.
-#
-
-use lib '/home/bbs/bin/';
-use LocalVars;
-use strict;
-use vars qw/@titles/;
-
-chdir '/home/bbs';
-getudnnewstitle(\@titles);
-foreach( @titles ){
- postout({brdname => 'udnnews',
- title => strreplace(FormatChinese($_->[1])),
- owner => 'udnnews.',
- content => getudnnewscontent("http://www.udn.com/NEWS/FOCUSNEWS/$_->[0]", $_)});
-}
-
-sub strreplace
-{
- my($str) = @_;
- $str =~ s/十/十/g;
- $str =~ s/卅/卅/g;
- $str =~ s/游錫\&\#22531\;/游揆/g;
- return $str;
-}
-
-sub getudnnewscontent($$)
-{
- 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/<p>/\n/gi;
- $content =~ s/<.*?>//g;
- $content =~ s/&nbsp;//g;
- $content =~ s/\r//g;
- $content =~ s/\n+/\n/gs;
- $content = strreplace($content);
- undef $ret;
- foreach( split(/\n/, $content) ){
- s/ //g;
- $ret .= FormatChinese($_, 60). "\n" if( $_ );
- }
- return
- "作者: udnnews.(聯合新聞網) 看板: udnnews\n".
- "標題: $title\n".
- "時間: 即時\n".
- "※ [轉錄自 $url ]\n\n$ret\n\n".
- "--\n\n 聯合新聞網 http://www.udn.com/ 獨家授權批踢踢實業坊 ".
- "\n 未經允許\請勿擅自使用 ";
-}
-
-sub getudnnewstitle($)
-{
- my($ra_titles) = @_;
- my($url, $title);
- open FH, "$LYNX -source http://www.udn.com/NEWS/FOCUSNEWS/ | $GREP '<font color=\"#FF9933\">' |";
- while( <FH> ){
- ($url, $title) = $_ =~ m|<font color="#FF9933">.</font><a href="(.*?)"><font color="#003333">(.*?)</font></a><font color="#003333">|;
- $title =~ s/<.*?>//g;
- push @{$ra_titles}, [$url, $title];
- }
- close FH;
- return @{$ra_titles};
-}
-
-sub FormatChinese
-{
- my($str, $length) = @_;
- my($i, $ret, $count, $s);
- return if( !$str );
- for( $i = 0 ; $i < length($str) ; ++$i ){
- if( ord(substr($str, $i, 1)) > 127 ){
- $ret .= substr($str, $i, 2);
- ++$i;
- }
- else{
- for( $count = 0, $s = $i ; $i < length($str) ; ++$i, ++$count ){
- last if( ord(substr($str, $i, 1)) > 127 );
- }
- --$i;
- $ret .= ' ' if( $count % 2 == 1);
- $ret .= substr($str, $s, $count);
- }
- }
- if( $length ){
- $str = $ret;
- undef $ret;
- while( $str ){
- $ret .= substr($str, 0, $length)."\n";
- $str = substr($str, $length);
- }
- }
- return $ret;
-}
-
-sub postout
-{
- my($param) = @_;
- return if( !$param->{title} );
- open FH, ">/tmp/postout.$$";
- print FH $param->{content};
-#print "$param->{content}";
- close FH;
-
- system("bin/post '$param->{brdname}' '$param->{title}' '$param->{owner}' /tmp/postout.$$");
- unlink "/tmp/postout.$$";
-}