napa182 commented on a Page, Top News Bot code   -  Aug 25, 2010

joehaglund use this one to notice

on $*:text:/^`news?\s?([uwtpehso])?\s?(\d+)?/iS:#: {
  if (!$regml(1) || !$regml(2) || $regml(2) >= 11) { msg # To Get $iif($regml(1) = u,US,$iif($regml(1) = w,World,$iif($regml(1)t,Technology,$iif($regml(1) = p,Politics,$iif($regml(1) = e,Entertainment,$iif($regml(1) = h,Health,$iif($regml(1) = s,Sports,$iif($regml(1) = o,OddlyEnough, $&
      $iif(!$istok(u w t p e h s o,$regml(1),32),US / World / Technology / Politics / Entertainment / Health / Sports / OddlyEnough,))))))))) News Please type @news $iif($regml(1) = u,<u>,$iif($regml(1) = w,<w>,$iif($regml(1) = t,<t>,$iif($regml(1) = p,<p>,$iif($regml(1) = e,<e>,$iif($regml(1) = h,<h>, $&
      $iif($regml(1) = s,<s>,$iif($regml(1) = o,<o>,$iif(!$istok(u w t p e h s o,$regml(1),32),<uwtpehso>,))))))))) $&
    < number of news story > 1-10 ex: @news $iif(!$istok(u w t p e h s o,$regml(1),32),t,$regml(1)) 3 }
  else {
    if ($sock(news)) sockclose news 
    sockopen news www.reuters.com 80
    sockmark news $iif($regml(1) = u,us,$iif($regml(1) = w,world,$iif($regml(1) = t,technology,$iif($regml(1) = p,politics,$iif($regml(1) = e,entertainment,$iif($regml(1) = h,health,$iif($regml(1) = s,sports,$iif($regml(1) = o,oddlyEnough)))))))) $regml(2) .notice $nick
  }
}
on *:sockopen:news: {
  sockwrite -n $sockname GET $+(/news/,$gettok($sock(news).mark,1,32)) HTTP/1.1
  sockwrite -n $sockname Host: $+($sock(news).addr,$str($crlf,2))
}
on *:sockread:news: {
  var %news | sockread %news
  if ($regex(%news,/(<h1>|<h2>)<a href="/article.+>(.+)<\/a>$/)) { inc -u4 %nf  
    if (%nf = $gettok($sock(news).mark,2,32)) {
      sockmark news $addtok($sock(news).mark,04 $+($upper($left($gettok($sock(news).mark,1,32),1)),$&
        $lower($right($gettok($sock(news).mark,1,32),-1))) News: Story Number: $gettok($sock(news).mark,2,32) :  $regml(2) :,32) 
    } 
  }
  if ($regex(%news,/(<\/h2><p>|<p>)(.+)(<\/p>|\|&nbsp;)/) && %nf = $gettok($sock(news).mark,2,32)) {
    $gettok($sock(news).mark,3-,32) $replace($regml(2),&amp;,&)  
    sockclose news 
  }
}
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.