napa182 commented on a Page, Latets News from the world of Science (physorg.com)  -  Mar 18, 2012

Odd way to go about it adding so many sockets that is.. You should have just used one socket to check for the news you are looking for on that one site. It wouldn't be hard to do...

What I mean is you can find away to make it do it in one socket instead of making 9 sockets.. Here is just one way keep in mind I haven't coded in msl in some time...

on $*:text:/^!(ph|qm|nano|space|astro|chem|bio|math|tech)news$/iS:#:{
  if (!%f) { inc -u5 %f
    if ($sock(physics)) sockclose physics
    sockopen physics www.physorg.com 80
    sockmark physics $+(/rss-feed/,$iif($regml(1) = ph,physics-news,$iif($regml(1) = qm,$&
      physics-news/quantum-physics,$iif($regml(1) = nano,nanotech-news,$iif($regml(1) = space,$&
      space-news/space-exploration,$iif($regml(1) = astro,space-news/astronomy,$iif($regml(1) = chem,$&
      chemistry-news,$iif($regml(1) = bio,biology-news,$iif($regml(1) = math,science-news/mathematics,$iif($regml(1) = tech,$&
      technology-news))))))))),/) msg # 0,14 $iif($regml(1) = ph,Physics,$iif($regml(1) = qm,Quantum Physics,$iif($regml(1) = nano,$&
      NanoTechology,$iif($regml(1) = space,Space,$iif($regml(1) = astro,Astronomy,$iif($regml(1) = chem,$&
      Chemistry,$iif($regml(1) = bio,Biology,$iif($regml(1) = math,Mathematics,$iif($regml(1) = tech,Technology))))))))) News: 
  }
}
on *:sockopen:physics: {
  sockwrite -nt physics GET $gettok($sock(physics).mark,1,32) HTTP/1.1
  sockwrite -nt physics Host: $+($sock(physics).addr,$str($crlf,2))
}
on *:sockread:physics: {
  var %physics | sockread %physics
  if (%phy = 5) { sockclose physics }
  if ($regex(%physics,/<title>(.+)<\/title>/)) { inc -u5 %phy
    if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
  }
  if ($regex(%physics,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
    if (%phyy isnum 2-4) {  $gettok($sock(physics).mark,2-,32) $hget(phy,1) 14 @ $regml(1)
    }
  }
}
 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.