#!/usr/local/bin/descartes

<proxy #proxy>
	(::sys <getenv #p http_proxy> | <is #p "">)
	::sys <split #p1 #p "/">
	( <eq #p1 ()> <is #proxy "">
	 |
	  ::sys <car #p2 #p1>
	  <is "http:" #p2> ::sys <cadr #proxy #p1>
	 |
	  <is #proxy #p>
	 )
	;

<first8 () () _>;
<first8 () _ 8>;

<first8 (#i :#r) (#i :#rest) #n>
	<#n1 = #n + 1>
	<first8 #r #rest #n1>
	;
<first8 #out #l>
	<first8 #out #l 0>
	;

// svȏo̗͂}~
? ::sys <PrintResultOff>;

<asahi #t3>
  ::sys <httpget #h #b "http://www.asahi.com/" <proxy _>> @//asahi.comhtml𕶎
						  //Ďo
  ::sys <iconv #bd #b "UTF-8" "EUC-JP">@@@//tseWɕϊ
  ::sys <htmldecode #bu #bd>
  ::sys <htmltags #t #bu 'div id="HeadLine"' 'ul class="FollowLnk"'>
					//wbhC̔o
  ::sys <htmltags #t2 ::sys <car _ #t> "a href" "/a">
					//N(<a href ...> </a>)o
  ::sys <erasealltags #t3 #t2>		//Ȃ^O
  ;


<yomiuri #t3>
  ::sys <httpget #h #b "http://www.yomiuri.co.jp/" <proxy _>>
  ::sys <iconv #bd #b "UTF-8" "SJIS">
  ::sys <htmldecode #bu #bd>
  ::sys <htmltags #t #bu 'div class="headline-def"' "/ul">
  ::sys <erasetags #t1 #t 
	'img src="/g/d.gif" width="1" height="1" alt="W"' "/li" >
  ::sys <htmltags #t2 ::sys <car _ #t1> "a href" "/a">
  ::sys <erasealltags #t3 #t2>
  ;

<mainich #t3>
  ::sys <httpget #h #bd "http://mainichi.jp/" <proxy _>>
  ::sys <htmldecode #b #bd>
  ::sys <htmltags #t #b 'header class="topicsHeader"' 
			'div class="topicsPhotoWrapper"'>
  ::sys <htmltags #t2 ::sys <car _ #t> "a href" "/a">
  ::sys <erasealltags #t3 #t2>
  ;


<sankei #list>
  ::sys <httpget #h #bd "http://sankei.jp.msn.com/" <proxy _>>
  ::sys <htmldecode #b #bd>
  ::sys <htmltags #t #b 'div class="RightPart"' 'div id="ADkinkoku"'>
  ::sys <htmltags #t2 ::sys <car _ #t> "a href" "/a">
  ::sys <erasealltags #t3 #t2>
  ::sys <cons #list ::sys <car _ #t3> ::sys <cddr _ #t3>>
  ;


<tokyo #t3>
  ::sys <httpget #h #b "http://www.tokyo-np.co.jp/" <proxy _>>
  ::sys <iconv #bd #b "UTF-8" "SJIS">
  ::sys <htmldecode #bu #bd>
  ::sys <htmltags #t #bu 'div id="NewsArea"' "/ul">
  ::sys <htmltags #t2 ::sys <car _ #t> "a href" "/a">
  ::sys <erasealltags #t3 #t2>
  ;

<slashdotj #list>
  ::sys <httpget #h #bd "http://slashdot.jp/" <proxy _>>
  ::sys <htmldecode #bu #bd>
  ::sys <htmltags #t #bu 'body' '/body'>
  ::sys <htmltags #t2 #t 'span id="title-' '/span'>
  ::sys <erasealltags #t3 #t2>
  ::sys<car #t4 #t3>
  <first8 #list #t4>
  ;

<displaynews>
  <asahi #asahi>
  <yomiuri #yomiuri>
/*
  <mainich #mainichi>
  <sankei #sankei>
  <tokyo #tokyo>
*/
  <slashdotj #slashdotj>

  <print "V www.asahi.com wbhC">
  <printlistnl #asahi>
  <print>

  <print "ǔV www.yomiuri.co.jp wbhC">
  <printlistnl #yomiuri>
  <print>
/*
  <print "V mainichi.jp wbhC">
  <printlistnl #mainichi>
  <print>

  <print "Yomsn sankei.jp.msn.com wbhC">
  <printlistnl #sankei>
  <print>

  <print "V www.tokyo-np.co.jp wbhC">
  <printlistnl #tokyo>
  <print>
*/
  <print "slashdot.jp XbVhbg wbhC">
  <printlistnl #slashdotj>
  <print>
  ;


