joelp53 commented on a Page, CNN top stories  -  May 17, 2010

little edit to make it notice the user

on *:text:!cnn *:#: { 
  if ($2 isnum && $2 >= 1) { set %cnnstory $round($2,0) } 
  if ($2 == sports) { set %cnnstory All | set %feed /rss/si_topstories.rss } 
  elseif ($2 == us) { set %cnnstory All | set %feed /rss/cnn_us.rss } 
  elseif ($2 == world) { set %cnnstory All | set %feed /rss/cnn_world.rss } 
  elseif ($2 == topstories) { set %cnnstory All | set %feed /rss/cnn_topstories.rss } 
  elseif ($2 == living) { set %cnnstory All | set %feed /rss/cnn_living.rss } 
  elseif ($2 == travel) { set %cnnstory All | set %feed /rss/cnn_travel.rss } 
  elseif ($2 == showbizz) { set %cnnstory All | set %feed /rss/cnn_showbiz.rss } 
  elseif ($2 == health) { set %cnnstory All | set %feed /rss/cnn_health.rss } 
  elseif ($2 == space) { set %cnnstory All | set %feed /rss/cnn_space.rss } 
  elseif ($2 == tech ) { set %cnnstory All | set %feed /rss/cnn_tech.rss } 
  elseif ($2 == politics) { set %cnnstory All | set %feed /rss/cnn_allpolitics.rss } 
  elseif ($2 == crime) { set %cnnstory All | set %feed /rss/cnn_crime.rss } 
  elseif ($2 == money) { set %cnnstory All | set %feed /rss/money_latest.rss }
  elseif ($2 == recent) { set %cnnstory All | set %feed /rss/cnn_latest.rss }
  elseif ($2 == help) { notice $nick triggers are sports, us, world, topstories, living, travel, showbizz, health, space, tech, politics, crime, money, recent
    notice $nick type !cnn sports for sports news, !cnn us for USA news, etc. Then type !cnn 1 to 10 for more info
  /halt  }
  set %cnnchan $chan 
  sockopen CNN rss.cnn.com 80 

}
on *:sockopen:CNN: { 
  sockwrite -n $sockname GET %feed HTTP/1.1 
  sockwrite -n $sockname Host: rss.cnn.com  
  sockwrite -n $sockname Connection: close 
  sockwrite -n $sockname $crlf 
} 
on *:sockread:CNN: { 
  sockread %cnntemp 
  if (<title> isin %cnntemp) { inc %tt 1 | set %cnntitle $+ %tt $nohtml(%cnntemp) } 
  if (<link> isin %cnntemp) { inc %ttt 1 | set %cnnlink $+ %ttt $nohtml(%cnntemp) } 
  if (<pubDate> isin %cnntemp) { inc %ttttt 1 | set %cnndate $+ %ttttt $nohtml(%cnntemp) } 
  if (<description> isin %cnntemp) { inc %tttt 1 | set %cnndesc $+ %tttt $remove($nohtml(%cnntemp),$(&lt;div class="feedflare"&gt;)) } 
} 
on *:sockclose:CNN: { 
  if (%cnnstory == All) { 
    var %o 3 | while (%o <= $var(%cnntitle*,0)) { 
      notice %cnnchan 4,15 [Title: $calc(%o -2) $+ ] $var(%cnntitle*,%o).value | inc %o 
    } 
  } 
  else { 
    if ($calc(%cnnstory +2) > $var(%cnntitle*,0)) { notice $nick There are only $calc($v2 -2) options. } 
    else { 
      notice %cnnchan 4,15 [Title:] $($+(%,cnntitle,$calc(%cnnstory +2)),2) 
      notice %cnnchan 4,15 [Published:] $($+(%,cnndate,$calc(%cnnstory +1)),2) 
      notice %cnnchan 4,15 [Description:] $($+(%,cnndesc,$calc(%cnnstory +2)),2) 
      notice %cnnchan 4,15 [Link:] $($+(%,cnnlink,$calc(%cnnstory +2)),2) 
    } 
  } 
  unset %cnn* %tt %ttt %tttt %ttttt 
} 
alias -l nohtml { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) 
  return %x 
}
 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.