summaryrefslogblamecommitdiffstats
path: root/util/weather.perl
blob: 5e2c8d4f334ee5c728e26b36cd7573a890d14906 (plain) (tree)
1
2
3
4
5
6
7
8
               
                                                       





                                                                     



                        








                                               

                                                                                                                                                   
 
                   




                           











                                                                       
#!/usr/bin/perl
# $Id: weather.perl,v 1.5 2003/03/01 06:12:20 bbs Exp $
#
# 不能跑的話,看看 bbspost 的路徑是否正確。
# 如果發出的 post 沒有氣象報告而是說 URL 找不到,則確定一下能不能看到
# 中央氣象局的 WWW 及 URL 是否正確。
# 理論上適用所有 Eagle BBS 系列。
#                                       -- Beagle Apr 13 1997

use lib '/home/bbs/bin';
use LocalVars;

open(BBSPOST, "| bin/webgrep>etc/weather.tmp");
# 日期
open(DATE, "date +'%a %b %d %T %Y' |");
$date = <DATE>;
chop $date;
close DATE;

# Header
# 內容
#open(WEATHER, "$LYNX -assume_charset=big5 -assume_local_charset=big5 -dump http://www.cwb.gov.tw/V3.0/weather/text/W03.htm |");
open(WEATHER, "$LYNX -assume_charset=big5 -assume_local_charset=big5 -dump -nolist http://www.libertytimes.com.tw/2003/new/mar/today/Wnews1.htm|");

while (<WEATHER>) {
    last if /今日天氣/;
}

while (<WEATHER>) {
  last if /top\.gif/;
  print BBSPOST if ($_ ne "\n");
}
close WEATHER;

# 簽名檔
print BBSPOST "\n--\n";
print BBSPOST "我是beagle所有可愛的小餅乾...跨海為Ptt服務\n";
print BBSPOST "--\n";
print BBSPOST "☆ [Origin: ◎果醬小站◎] [From: [藍莓鬆餅屋]       ] ";

close BBSPOST;