_Dean_ commented on a Page, Ask.com  -  Nov 03, 2011

since you have asked it Kiddo96, i think you can use one regex match instead 2

this is a simple example, and i added the $replace for " to "
and a check to check if the results match

alias ask {
  if $1 {
    if $sock(ask) {
      sockclose $v1
    }
    sockopen ask www.ask.com 80
    sockmark ask $1-
  }
  else {
    echo -a 04Error! Incorrect syntax.
  }
}
on *:sockopen:ask:{
  var %x = sockwrite -nt $sockname 
  %x GET /web?qsrc=1&o=0&l=dir&q= $+ $urlencode($sock($sockname).mark) HTTP/1.1
  %x Host: www.ask.com
  %x Connection: close
  %x
}
on *:sockread:ask:{
  var %askreader
  sockread %askreader
  if $regex(%askreader,/<div\s(?:id="r\d+_a"|class="txt3 abstract")\s(?:class="txt3 abstract"|id="r\d+_a")>(.+)(?:<\/div>|<\/span>)|<span class="answers_ui_t\d+">(.+)<\/span>/U) {
    echo -a 09 $+ $char_r($replace($regml(1),<b>,,</b>,,&quot;,"))
    sockclose $sockname
  }  
  if (*did not match* iswm %askreader) { echo -ag 09 Your search for $qt($sock($sockname).mark) did not match with any Web results. | sockclose $sockname 
  }
}
alias urlencode return $regsubex($1,/(\W)/gS,% $+ $base($asc(\1),10,16,2)))
alias char_r return $regsubex($1-,/&#(\d+);/g,$chr(\1))

i didnt tried another thing, but i think we can improve a lot
if i think in something i will post it

 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.