Hi All
Here is my first attempt working with Sockets.
First of all i need to Thanks QuickStep for his great Sockets Tutorial and mountaindew for help me with Regular Expressions (the one that retrive Filenames and Regions)
The snippets is simple: load it on the remote of your bot and write: !abgx [search criteria]
Enjoy it, hope this time i get at least 1 comment :)
Cheers
essebi
on *:LOAD: {
echo -s ABGX.org Search engine Succesfully Loaded | echo -s Trigger is !abgx [search criteria] }
on *:text:!abgx*:*: {
if (%search == 1) { .msg $chan Sorry $nick but i'm handling another request, wait some seconds and try it again | halt }
if ($2) {
if ($sock(abgx)) sockclose abgx
set %nick $nick
set %search 1
.write -c $mircdir $+ abgx.txt
sockopen abgx www.abgx.net 80
sockmark abgx $+($2-,|,$nick)
.msg $nick Searching abgx.net for $qt($2-) $+ ...
.timer 1 5 playtxt
}
else .msg $nick Syntax: !abgx [search criteria]
}
on *:sockopen:abgx:{
sockwrite -n $sockname GET /filename/?ch=6&bin_search_type=folder&bin_max_results=50&bin_search= $+ $urlencode($gsm($sockname,1)) $+ &bin_search_results=0 HTTP/1.1
sockwrite -n $sockname Host: www.abgx.net
sockwrite -n $sockname $crlf
}
on *:sockread:abgx:{
var %abgx
sockread %abgx
if (*TARGET="_blank">*</A></font></div></div></td>* iswm %abgx) set %relname $htmlfree($remove($gettok(%abgx,7-,32),))
if (*Gfx/nuke.png* iswm %abgx) var %nuke [NUKED] ~
if ($regex(%abgx,/<td align="center" valign="middle" wrap width="1%">(.+)<div class="/i)) {
noop $regex($regml(1),/^(.+)</td>.+width="1%">(.+)</td><td align="center" valign="middle" nowrap width="1%">.+</td>/i)
.write $mircdir $+ abgx.txt %nuke Release name: %relname ~ Region: $regml(2) ~ File Name: $regml(1)
}
}
alias urlencode {
var %a = $regsubex($$1,/([^ws])/Sg,$+(%,$base($asc(t),10,16,2)))
return $replace(%a,$chr(32),$chr(43))
}
alias -l htmlfree {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&,$chr(9))
return %x
}
alias gsm return $gettok($sock($1).mark,$2,124)
alias playtxt {
sockclose abgx
set %search 0
if ($lines($mircdir $+ abgx.txt) == 0) {
.msg %nick Sorry but nothing match your search criteria
unset %nick %relname
halt
}
if ($lines($mircdir $+ abgx.txt) > 10) {
.clearlines
.play -m1 %nick $mircdir $+ abgx.txt
unset %nick %relname
halt
}
else {
.play -m1 %nick $mircdir $+ abgx.txt
unset %nick %relname
}
}
alias -l clearlines {
var %i = $lines($mircdir $+ abgx.txt)
while (%i > 5) {
/write -dl %i $mircdir $+ abgx.txt
dec %i
}
.write -il1 $mircdir $+ abgx.txt There are too many results that match your search criteria, here is the first 5 results. Please be more specific or go to http://www.abgx.net/filename/?ch=6
}
Hi essebi,
It's a nice script, however since you're parsing the actual pages this consumes quite a bit of bandwidth. Lately, I've begun to block IPs which I notice are using more bw than normal -- as it's usually an indication of a script such as this being used.
Since it's an IRC script (so you're obviously already on IRC when using it), might I suggest an alternate method that messages the bot directly? It'll be much quicker, direct, and will consume a lot less bw (and won't be prone to being IP-blocked).
Many of the commands for GoogleBot and BinaryBot can be done via msg and with full or abbreviations for the channel names. A couple examples being:
.msg BinaryBot -search x360 yoursearchkeywords
.msg GoogleBot -gamesearch x360 yoursearchkeywords
"-search" searches the requests/filling/posted
"-gamesearch" searches the game database
Channel abbreviations are:
x360 == #alt.binaries.games.xbox360
abgx == #alt.binaries.games.xbox
abd == #alt.binaries.dreamcast
absp == #alt.binaries.sony.psp
abgn == #alt.binaries.games.nintendods
abgw == #alt.binaries.games.wii
abcp == #alt.binaries.console.ps3
Regards,
MomDad
Hey, well done man. A couple comments tho. One is, this should say .net ...
.msg $nick Searching abgx.org for $qt($2-) $+ ...
LOL!! You\'re right, i\'ve tested it for over 2 weeks and no one notice me, damn friends! *edited :)
Regarding your second questions, i\'m related to xbox and i don\'t think to add other systems, but if you need it is really simple to do, you only need to make a variable for \" ch=6 \" on the url, is the only thing that will change on this code.
Cheers
essebi
Hey, well done man. A couple comments tho. One is, this should say .net ...
.msg $nick Searching abgx.org for $qt($2-) $+ ...
Also, why don\'t you include a link to the files it finds?
And then I wanted to ask if you plan on adding capabilities to look through the other systems like psp, ps2, ps3, or even nintendo.
Anyhow, good job.
6/10