Hawkee Snippet Search

Platform:  mIRC
Published  Mar 17, 2008
Updated  Aug 01, 2010
This snippet searches for other snippets from Hawkee. You can search through all of them, or specify a category.

Syntax: [/snippets|!snippets] <-type> [search criteria]

[] = Required
<> = optional

Types:

* -asp
* -cpp
* -cfm
* -css
* -hi5
* -java
* -js
* -jsp
* -mirc
* -myspace
* -mysql
* -net
* -opensocial
* -perl
* -php
* -python
* -ruby
* -tcl

Examples:

/snippets trivia
!snippets -php print

Screen:



As default, it returns the top 3 matches. If you'd like to change the number of matches it returns, change "if (%N == 3)" to "if (%N == NUMBER)"

Enjoy

Thanks FordLawnmower for editing the script to work properly ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
; Hawkee Snippet Search *
; Made by MountainDew ~
; Revisions made by FordLawnmover ~
; IRC.DeltaAnime.Net » #Lindrian #mIRC-Scripting *
; US.UnderNet.Org » #Hawkee.com #mircscripting ~
;*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

on $*:TEXT:/^[.!@](snip(pets)?|hawk(ee)?)/Si:#:{
set %s.chan $iif($chan == #msl,$nick,$v1)
snippets $2-
}
alias snippets {
if ($sock(snippets)) {
%smsg Wait until the current search has been finished.
halt
}
set %smsg $iif(%s.chan,$iif(%s.chan == #msl,notice,msg) %s.chan,echo -a)
if (!$1) {
%smsg Syntax: $iif(%s.chan,!,/) $+ snippets [-type] <search criteria>
halt
}
if ($left($1,1) == -) {
if ($istok(-asp|-cfm|-css|-java|-js|-jsp|-mirc|-mysql|-net|-perl|-php|-python|-ruby|-tcl|-myspace|-opensocial|-cpp|-hi5,$1,124)) {
if (!$2) {
%smsg Please specify search criteria.
halt
}
set %s.prop $1
}
else {
%smsg The available switches are: -asp cpp -cfm -css -hi5 -java -js -jsp -mirc -myspace -mysql -net -opensocial -perl -php -python -ruby -tcl
halt
}
}
set %s.search $iif(%s.prop,$2-,$1-)
$iif(%s.chan,describe %s.chan searches,echo -a Searching) for $qt(%s.search) in $iif(%s.prop,$replace(%s.prop,-asp,ASP,-cpp,C++,-cfm,CFM,-css,CSS,-java,Java,-js,JavaScript,-jsp,JSP,-mirc,mIRC,-mysql,MYSQL,-net,.NET,-perl,Perl,-php,PHP,-python,Python,-ruby,Ruby,-tcl,TCL,-myspace,MySpace,-opensocial,OpenSocial,-hi5,Hi5)) Snippets...
sockopen snippets www.hawkee.com 80
}
on *:sockopen:snippets:{
set %s.url $+(/,$iif(%s.prop,$+($mid(%s.prop,2-),/)),snippets/search/,$replace(%s.search,$chr(32),+),/)
unset %s.prop
if (!$sockerr) {
sockwrite -nt $sockname GET %s.url HTTP/1.0
sockwrite -n $sockname Host: www.hawkee.com
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) }
}
on *:sockread:snippets:{
var %x
sockread %x
if (We couldn't find any snippets to match your search. isin %x || We have not received any snippets for this section yet. isin %x) {
%smsg Sorry, no matches were found for $qt(%s.search) $+ .
unset %s.*
sockclose $sockname
}
if ($regex(%x,/'>([^<]*) like\(s\)/i)) set %s.likes $regml(1)
if ($regex(%x,/Score: <b>([^<]*)<\/b>/)) set %s.rating $regml(1)
if ($regex(%x,/<a href='([^<]*)' class='large'>([^<]*)<\/a>/)) {
set %s.title $regml(2)
set %s.url2 http://www.hawkee.com $+ $regml(1)
}
if ($regex(%x,/Added:<\/span> ([^<]*\x2C\s[\d^<]{4})/)) { set %s.date $regml(1) }
if ($regex(%x,/By:<\/span> <a href='http:\/\/www.hawkee.com\/profile\/[^<]*\/'>([^<]*)<\/a>/)) { set %s.by $regml(1) }
if ($regex(%x,/<a href="\/.*\/snippets\/">([^<]+)<\/a>/i)) {
set %s.lang $regml(1)
inc %N
%smsg 9• 4Title: %s.title 4Author: %s.by 4Sumbitted: %s.date 4Language: %s.lang 4Score: %s.rating 4Likes: %s.likes 4URL: %s.url2
if (%N == 3) {
unset %s.* %N %smsg
sockclose $sockname
}
}
if (<div id="sidebar"> isin %x) sockclose $sockname
}
on *:sockclose:snippets: unset %s.* %N %smsg
alias hawk snippets $1-
alias snip snippets $1-
alias hawkee snippets $1-

Comments

Sign in to comment.
ovelayer   -  Sep 18, 2013
i really like this script but it doesnt show all information correctly anymore probably due to site updates..any change for an update on this script?
[11:11pm] <!xXBERTOXx> !snippet stats
[11:11pm] * !Bong searches for "stats" in Snippets...
[11:11pm] <!Bong> • Title: Stats Author: Sumbitted: Language: mIRC Snippet Score: Likes: URL: http://www.hawkee.com/snippet/4514/
[11:11pm] <!Bong> • Title: Stats Author: Sumbitted: Language: mIRC Snippet Score: Likes: URL: http://www.hawkee.com/snippet/2724/
 Respond  
FordLawnmower   -  Aug 02, 2010
yw mountaindew :)
 Respond  
Cheiron   -  Aug 02, 2010
wooot!!!!

we're back in business. many many thanks guys. this is one very valuable script for any server with a scripting channel. i just need to re-edit the message channel to message nick to keep the channel spam out of sight.

:D
 Respond  
mountaindew   -  Aug 01, 2010
Updated the script, thanks FordLawnmower.
 Respond  
FordLawnmower   -  Aug 01, 2010
This edit seems to be working Cheiron:
Code
 

I'll keep my fingers crossed because my power went out while I was editing it and when it came back on the script was working fine.
 Respond  
FordLawnmower   -  Aug 01, 2010
I'll have a look and post something back Cheiron.
Kind of busy right now but I will try to get to it later tonight or tomorrow when I get home from work.
 Respond  
Cheiron   -  Aug 01, 2010
its gonna need a edit this. it wont work just doing !snippets flyby for example and this level of coding is far beyond me what is specified above on the source there
 Respond  
Hawkee   -  Aug 01, 2010
We did recently change the URL structure. It is no longer /snippets/cat/mirc/ but /mirc/snippets/. The code should be easily changed to support this. It may still work if you don't request a particular platform.
 Respond  
Cheiron   -  Aug 01, 2010
not sure what changes have been made on the hawkee site of late.. but this script no longer returns results :(

it gets stuck on


* Titan_Bot searches for "mirc flyby" in Snippets...

etc with no results.
 Respond  
Cheiron   -  Apr 20, 2010
bingo! thankies
 Respond  
Jethro   -  Apr 20, 2010
Cheiron, I'm not gonna fiddle with the rest of code, but a quick fix to make it message the nick instead of the channel is by changing this line:
set %s.chan $iif($chan == #msl,$nick,$v1)
to
Code
 
I hope Ford doesn't mind that I've offered a suggestion...He could later rework the whole code for you to refine it.

P.S. I realize the sockclose event isn't needed, though...without it, it unsets the vars either way.
 Respond  
Cheiron   -  Apr 20, 2010
Comments: 703

mIRC Snippet: Hawkee Snippet Search
Posted on Apr 19, 2010 7:34 pm
O.o But that's like 50 results ;/ Did you change the counter?
Code:
if (%N == 3) {

If not, I'll look at it again tomorrow.

i did look at that line and it is set to 3. i did a normal sesrch on hawkee website and the results matched. there are a good few bots!
now..
how do i edit it so it pm's the results not messages the channel?
 Respond  
Jethro   -  Apr 19, 2010
Thanks, Ford. I see why a sockclose event can be omitted and use something as per your example, and I quote:
if ($regex(%x,/<a href="\/snippets\/cat\/[^<]+\/">([^<]+)<\/a>/i)) {
set %s.lang $regml(1)
inc %N
%smsg 9• 4Title: %s.title 4Author: %s.by 4Sumbitted: %s.date 4Language: %s.lang 4Score: %s.rating 4Likes: %s.likes 4URL: %s.url2
if (%N == 5) {
unset %s.* %N %smsg
sockclose $sockname
}
}
if (<div id="sidebar"> isin %x) sockclose $sockname
}
Thanks again for your suggestion. I'll take that as a new lesson when dealing with sockets from now on. It is much faster and save many, many unneeded line reads.
 Respond  
FordLawnmower   -  Apr 19, 2010
O.o But that's like 50 results ;/ Did you change the counter?
Code
 

If not, I'll look at it again tomorrow.
 Respond  
Cheiron   -  Apr 19, 2010
oh yes! bingo


12<20112:216am12> <Sleeping_On_The_Job> !snip mirc bot
12<20112:216am12> * Titan_Bot searches for "mirc bot" in Snippets...
12<20112:216am12> <Titan_Bot> 9• 4Title: Basic Mirc Bot 4Author: Aucun50 4Sumbitted: Dec 15, 2008 4Language: mIRC Snippet 4Score: 1.0 4Likes: 1 4URL: http://www.hawkee.com/snippet/5482/
12<20112:216am12> <Titan_Bot> 9• 4Title: Emech mirc bot 4Author: vsTerminus 4Sumbitted: Dec 07, 2008 4Language: mIRC Snippet 4Score: 5.6 4Likes: 2 4URL: http://www.hawkee.com/snippet/1667/
12<20112:216am12> <Titan_Bot> 9• 4Title: mIRC help system for you bot 4Author: FordLawnmower 4Sumbitted: May 17, 2009 4Language: mIRC Snippet 4Score: 8.5 4Likes: 7 4URL: http://www.hawkee.com/snippet/6154/
12<20112:216am12> <Titan_Bot> 9• 4Title: mIRC Paint 4Author: sunslayer 4Sumbitted: Oct 05, 2009 4Language: mIRC Snippet 4Score: 0.0 4Likes: 7 4URL: http://www.hawkee.com/snippet/6787/
12<20112:216am12> <Titan_Bot> 9• 4Title: mIRC Theme 4Author: TheNitelyfe 4Sumbitted: Sep 05, 2009 4Language: mIRC Snippet 4Score: 7.0 4Likes: 1 4URL: http://www.hawkee.com/snippet/6672/
12<20112:216am12> <Titan_Bot> 9• 4Title: mIRC Lock 4Author: sercan386 4Sumbitted: Feb 18, 2009 4Language: mIRC Snippet 4Score: 0.0 4Likes: 1 4URL: http://www.hawkee.com/snippet/5767/
12<20112:216am12> <Daughain> That seems to be it.
12<20112:216am12> <Titan_Bot> 9• 4Title: mIRC CoreScript 4Author: Kikseo 4Sumbitted: May 23, 2008 4Language: mIRC Snippet 4Score: 0.0 4Likes: 6 4URL: http://www.hawkee.com/snippet/4464/
12<20112:216am12> <Sleeping_On_The_Job> woo hoo!
12<20112:216am12> <Titan_Bot> 9• 4Title: mIRC information 4Author: lehmann14l 4Sumbitted: Aug 24, 2007 4Language: mIRC Snippet 4Score: 0.0 4Likes: 6 4URL: http://www.hawkee.com/snippet/3120/
12<20112:216am12> <Titan_Bot> 9• 4Title: mIRC notepad 4Author: RameN 4Sumbitted: Jan 31, 2006 4Language: mIRC Snippet 4Score: 3.0 4Likes: 6 4URL: http://www.hawkee.com/snippet/1688/
12<20112:216am12> <Titan_Bot> 9• 4Title: mIRC Greeter 4Author: ch1zra 4Sumbitted: Jul 12, 2005 4Language: mIRC Snippet 4Score: 4.5 4Likes: 6 4URL: http://www.hawkee.com/snippet/1170/
12<20112:216am12> * Parts: Titan_Bot (Cheiron@security.bot.for.Cheiron)
12<20112:216am12> <Daughain> Woot.


just need it to now go into the users pm box that issues the command rather than in channel. you da man FordLawnmore :) you da man
 Respond  
FordLawnmower   -  Apr 19, 2010
Try this version Cheiron -->> http://pastebin.com/NzVytspQ
 Respond  
Cheiron   -  Apr 19, 2010
many thanks. its 00:45 hours here in the uk. i might be up still.. if not i will get on it tomorrow when i wakies. appreciate this greatly.
 Respond  
FordLawnmower   -  Apr 19, 2010
Okay Cheiron :) I'll tighten up the regex on the longer ones and see what we get. Back in about a half hour.
 Respond  
Cheiron   -  Apr 19, 2010

[00:17] <Sleeping_On_The_Job> !snip mirc bot
[00:17] * Titan_Bot searches for "mirc bot" in Snippets...
4Title: 17 4Author: 822 4Sumbitted: 1290 4Language: 410 4Score: 3 4Likes: 2555 4URL: 2880
4Title: 757 4Author: 10 4Sumbitted: 4031 4Language: 1150 4Score: 1472 4Likes: 2669 4URL: 3069
4Title: 263 4Author: 10 4Sumbitted: 3278 4Language: 656 4Score: 1498 4Likes: 1661 4URL: 3079
4Title: 1034 4Author: 370 4Sumbitted: 2925 4Language: 12 4Score: 3282 4Likes: 1661 4URL: 2766
4Title: 501 4Author: 5 4Sumbitted: 3742 4Language: 894 4Score: 1644 4Likes: 2804 4URL: 3347
4Title: 992 4Author: 6 4Sumbitted: 3118 4Language: 1549 4Score: 1915 4Likes: 2277 4URL: 2969
4Title: 256 4Author: 8 4Sumbitted: 3285 4Language: 649 4Score: 1431 4Likes: 56 4URL: 3153
4Title: 698 4Author: 452 4Sumbitted: 2239 4Language: 12 4Score: 2387 4Likes: 56 4URL: 2807
4Title: 578 4Author: 8 4Sumbitted: 3958 4Language: 971 4Score: 2442 4Likes: 56 4URL: 3276
4Title: 2006 4Author: 1758 4Sumbitted: 3133 4Language: 1299 4Score: 2291 4Likes: 56 4URL: 1980
[00:17] <Sleeping_On_The_Job> ah it works.. but not how i want it too

that was all on the bot and nothing for me


12<21212:216am12> * Joins: Titan_Bot (Cheiron@security.bot.for.Cheiron)
12<21212:217am12> <Sleeping_On_The_Job> !snip mirc bot
12<21212:217am12> * Titan_Bot searches for "mirc bot" in Snippets...
12<21212:217am12> <Sleeping_On_The_Job> ah it works.. but not how i want it too
 Respond  
FordLawnmower   -  Apr 19, 2010
Okay Cheiron :)
Well I won't give up if you don't.
Please change the line to this so I can narrow it down to one or two variables:
Code
 

Please paste the results here:
 Respond  
Cheiron   -  Apr 19, 2010
that gave me the error messages again in status

-
* /write: line too long (line 68, script51.ini)
-
* /write: line too long (line 68, script51.ini)
-
* /write: line too long (line 68, script51.ini)
-
* /write: line too long (line 68, script51.ini)
-
* /write: line too long (line 68, script51.ini)
-
* /write: line too long (line 68, script51.ini)
-
* /write: line too long (line 68, script51.ini)
-
* /write: line too long (line 68, script51.ini)
-
* /write: line too long (line 68, script51.ini)
-
* /write: line too long (line 68, script51.ini)
-


nothing in my $mircdir .. and i traced it all the way to the mirc from search
 Respond  
FordLawnmower   -  Apr 19, 2010
Can you change it to this:
Code
 

And then pastebin the Output.txt file for me. It will be in your $mircdir if it doesn't error. It could be that I just need to tighten up the regex. It could be that the dongle is reading large sections of the page at a time instead of following the formatting.
 Respond  
Cheiron   -  Apr 19, 2010
oh that was odd... i replaced that echo -a %smsg with the line you just gave me and it gave me this on the bot


[20:24] <Sleeping_On_The_Job> !snip mirc bot
[20:24] * Titan_Bot searches for "mirc bot" in Snippets...
2645
828
3628

NO error message in status this time but no results either
 Respond  
FordLawnmower   -  Apr 19, 2010
Can you change it to this :
Code
 

I just want to see how long the line is, if possible.
 Respond  
Cheiron   -  Apr 19, 2010
only one instance is running i have made sure of that. the echo returns the same thing

-
* /echo: line too long (line 68, script51.ini)
-
* /echo: line too long (line 68, script51.ini)
-
* /echo: line too long (line 68, script51.ini)
-
* /echo: line too long (line 68, script51.ini)
-
* /echo: line too long (line 68, script51.ini)
-
* /echo: line too long (line 68, script51.ini)
-
* /echo: line too long (line 68, script51.ini)
-
* /echo: line too long (line 68, script51.ini)
-
* /echo: line too long (line 68, script51.ini)
-
* /echo: line too long (line 68, script51.ini)
-

as for the //echo bit that gave me

9• 4Title: 4Author: 4Sumbitted: 4Language: 4Score: 4Likes: 4URL:

line 51 is

echo -a %smsg 9• 4Title: %s.title 4Author: %s.by 4Sumbitted: %s.date 4Language: %s.lang 4Score: %s.rating 4Likes: %s.likes 4URL: %s.url2

i have done the /unset command too... and still get the same


 Respond  
FordLawnmower   -  Apr 19, 2010
I would still like to see what the message is that is too long. Did you change %smsg to echo -a %smsg ?
If I could see what it echo's I might be able to figure out what is going on.

also type this :
Code
 

From the bot thats running the script.
 Respond  
Jethro   -  Apr 19, 2010
Ford's edit works perfectly fine for me. Try unloading all the script your have in your remote and just running the script to see what happens.

Perhaps you have another duplicate that you're not aware of....which causes the conflict.
 Respond  
Cheiron   -  Apr 19, 2010

12<20512:236pm12> * Joins: Titan_Bot (Cheiron@security.bot.for.Cheiron)
12<20512:236pm12> <Sleeping_On_The_Job> !snip mirc bot
12<20512:236pm12> * Titan_Bot searches for "mirc bot" in Snippets...
12<20512:236pm12> <Sleeping_On_The_Job> dammit

still same thing.. i get a pause between the searches for .. then the status window goes nuts with that same error
 Respond  
FordLawnmower   -  Apr 19, 2010
';(
That doesn't really make a lot of sense though. Your browser uses sockets on port 80 also and I'm sure it's working. I'll do a little research and see if someone else has already addressed this issue.
**Edit**
Try this version Cheiron -->> http://pastebin.com/AsEZjp2j
Let me know what the result is.
 Respond  
Cheiron   -  Apr 19, 2010
its the mobile broadband dongle at fault. it wont accept the sockets. i have tried a few other sockets i have with the same failure.
 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.