This is a simple tool to search (all) of the snippets on the site.
Simply type /hawkee and wait for the result.
I made this while I was bored, it was a pain in the butt to make the regex work properly, the site was literally a bitch to parse.
I tried to make it seperetate for each section, but that didnt work ( for some reason) and i coudnt bother to keep trying, I was also going to make one to retrive the codes from the main site, but as the code on the main site (snippets) is on huge line, ~2k in len (line too long errors) i had some problems, but i'll fix it sooner or later, just need more time.
Until then, enjoy this (simple) one.
; Syntax: /hawkee <snippet to search for>
on *:sockopen:hawkee: {
if ($sockerr) {
echo -a Error connecting: $sock($sockname).wsmsg
sockclose hawkee
}
else {
sockwrite -n $sockname GET %hawkee.site HTTP/1.1
sockwrite -n $sockname Host: www.hawkee.com
sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8)
sockwrite -n $sockname $crlf
}
}
on *:sockread:hawkee: {
var %x
sockread %x
if ($regex(%x,/ \x28(\d+)\x29<\/td>/i)) && (!%all) %all = $regml(1)
if ($regex(%x,/<span class='shop_largest' id='score_'>(.*?)<\/span>/i)) %score = $regml(1)
if ($regex(%x,/<a href='(.*?)'.*?>(.*?)<\/a>.*?</)) {
if ($regml(2) != Home) {
%z = $calc(%z + 1)
if (%z == 1) {
%link = $regml(1)
%name = $regml(2)
}
elseif (%z == 2) {
%user = $regml(2)
%t = $calc(%t + 1)
if (%score > %ls) {
%ls = %score
%p = %t
}
set $+(%,hawkee.match.,%t) $iif($len(%t) == 1,0) $+ %t $+ . Title: %name Score: %score Author: %user Link: http://www.hawkee.com $+ %link
set %hawkee.result 1
unset %name %user %score %z
}
}
}
}
on *:sockclose:hawkee: {
if (!%hawkee.result) echo -a Sorry, there was no match for $qt(%hawkee.search) $+ ...
else {
var %x = 1, %h = $var(%hawkee.match.*,0)
while ($var(%hawkee.match.*,%x).value) {
var %i = $v1
echo -a $iif($gettok(%i,1,46) == %p && %t != 1,04 $+ %i - (Top rated!),%i)
inc %x
}
echo -a
echo -a Search for $qt(%hawkee.search) produced %h result(s) on page one $+ $iif(%h != %all,$chr(44) out of a total of %all matches. - Visit this site for all results: http://www.hawkee.com $+ %hawkee.site,.)
}
unset %hawkee.* %t %p %all %z %ls
}
alias hawkee {
if ($sock(hawkee)) .sockclose hawkee
if ($1) {
set %hawkee.search $1-
set %hawkee.site /snippets/?search_query= $+ $htmlfrm(%hawkee.search)
set %ls 0.0
sockopen hawkee www.hawkee.com 80
echo -a Looking for snippets matching $qt($1-) $+ ... Please hold.
echo -a
}
else echo -a You must specify something to search for! Use the following syntax: /hawkee <snippet>, eg: /hawkee mass modes
}
alias htmlfrm {
var %i = 1,%r
while (%i <= $len($1-)) {
if ($mid($1-,%i,1) isalnum) %r = %r $+ $v1
else %r = %r $+ % $+ $base($asc($mid($1-,%i,1)),10,16,2)
inc %i
}
return %r
}
alias h hawkee $1-
alias hawk h $1-
doesn\'t show the scores
ex:
- Name: Hawkee snippet search Score: Author: Lindrian Link: http://www.hawkee.com/snippet/3359/