Hawkee Snippet Searcher

By Ghost-writer on Apr 10, 2010

This is my hawkee searcher snippet :), you can type /search or have another user type !Search . The only way to see how good it is, is to try it yourself :).

-Updated as of 06/10/2010 & The problem was hawkee made it so it required a / at the end of the url :]. Simple fix.

on $*:TEXT:/^[.!@]Search/Si:#hawkee: {
  if (!$timer(Search)) {
    search $2-
    .timersearch 1 6 noop
    set %outatm $iif(@* iswm $1,msg #,notice $nick)
  }
}
alias nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}
alias search {
  var %sock $+(HawkeeSearch,$replace($1-,$chr(32),+))
  if ($sockname(%sock)) .sockclose %sock
  sockopen %sock www.hawkee.com 80
}
on *:SOCKOPEN:HawkeeSearch*: {
  sockwrite -nt $sockname GET $+(/snippets/search/,$remove($sockname,HawkeeSearch),/) HTTP/1.1
  sockwrite -nt $sockname Host: www.hawkee.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:HawkeeSearch*: {
  if (!$sockerr) {
    var %Quote
    sockread %Quote
    tokenize 32 %quote
    if (We couldn't find any snippets to match your search. isin $1-) {
      %outatm $dsz((Search) No queries could be found for your search " $remove($sockname,hawkeesearch) ")
      sockclose $sockname
    }
    if (snippet isin $1-) && (large isin $1-) {
      hadd -m $sockname Title $remove($nohtml($1-),$crlf,$chr(9))
      tokenize 39 $1-
      hadd -m $sockname Scurl $2
    }
    if (added: isin $1-) hadd -m $sockname Date $nohtml($1-)
    if (by isin $1-) && (profile isin $1-) {
      hadd -m $sockname Maker $nohtml($1-)
      tokenize 39 $1-
      hadd -m $sockname Prurl $4
      set %desc 2
    }
    if ($nohtml($remove($1-,br,<,>)) == $remove($1-,br,<,>)) && (%desc) {
      hadd -m $sockname Desc $remove($nohtml($1-),<br>,$chr(40),$chr(41))
      dec %desc
    }
    if (score isin $1-) hadd -m $sockname Score $nohtml($1-)
    if (#comment isin $1-) hadd -m $sockname Cmtot $nohtml($1-)
    if (platform isin $1-) && (script !isin $1-) {
      tokenize 47 $1-
      hadd -m $sockname Platform $remove($gettok($remove($4,.png),1,32),$chr(41))
      var %tmsg (Search) ( $+ $hget($sockname,title) $+ ) (http://www.hawkee.com $+ $hget($sockname,scurl) $+ ) (Made $hget($sockname,maker) ( $+ $hget($sockname,prurl) $+ ) $+ ) ( $+ $hget($sockname,date) $+ ) (Platform: $hget($sockname,platform) $+ ) ( $+ $hget($sockname,score) $+ ) ( $+ $hget($sockname,cmtot) $+ ) (Description: $hget($sockname,desc) $+ )
      $iif(%outatm,$v1,echo) $dsz($remove(%tmsg,$chr(9)))
      sockclose $sockname
    }
  }
}
alias dsz return $Replace($1-,$chr(40),12 $+ $chr(40) $+ 14,$chr(41),12 $+ $chr(41) $+ 14)

Comments

Sign in to comment.
Ghost-writer   -  Oct 06, 2010

Updated on request of Bourneident, easy fix :].

 Respond  
bourneident   -  Sep 04, 2010

:)

[07:37am] « ~BourneIdent » !search mp3
[07:37am] -%HelpDesk- (Search) (BeerBot v1) (http://www.hawkee.com/snippet/7918/) (Made By: hxck (http://www.hawkee.com/profile/57391/)) (Added: Sep 03, 2010) (Platform: mirc) (Score: 0.0) (2 comment(s)) (Description: The code could be a lot better, I know that. This is my first bigger project, way more than I've ever done at once.)

same thing no matter what i search and * /sockclose: insufficient parameters everytime can you fix this up

 Respond  
SnoooP   -  Apr 11, 2010

Nice work ghost-writer

 Respond  
Hawkee   -  Apr 10, 2010

This is good because it doesn't try to match all the details of the site CSS. It looks for the key components that won't be changing in the future to determine what is what on the page.

 Respond  
sunslayer   -  Apr 10, 2010

hawkee has been going ape shit on the site recently, mine is updated again

 Respond  
Jethro   -  Apr 10, 2010

Even that's the case, perhaps it's not his script to blame. He hasn't updated or realized it due to hawkee source code changes. And that's most likely the culprit for many Hawkee socket scripts to fail and cease to work. Have you wondered about that?

 Respond  
Ghost-writer   -  Apr 10, 2010

Sunslayers doesnt even work..

 Respond  
Jethro   -  Apr 10, 2010

Excuse me for bursting your bubble. Yours is not as good as Sunslayer's. But nevertheless, I commend your efforts. :)

 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.