!Dramatica Search Script w/Random

Platform:  mIRC
Published  Sep 15, 2009
Updated  Jun 16, 2013

*Update* This script now requires https so you must install Openssl to use this script.
Download and install OpenSSL: http://www.mirc.com/download/openssl/openssl-0.9.8r-setup.exe
This script searches encyclopediadramatica.com for your search item. If no search word is given, it will give results from a random word.
This script was requested by weishaupt.
Syntax for the script is !dramatica search word(s) or just plain !dramatica for random.
There is a ! trigger that will notice the user and a @ trigger that will message the channel if the user has halfops or higher.
***Disclaimer***
Just like the urban dictionary site, this site can render some very RUDE results. From my testing, I found some results to be racially insensitive. I also found some to be very anti-American.
It is up to the bot/channel owner to determine if this script is appropriate for their channel/network.
*************** ;Encyclopedia Dramatica Search Script by Ford_Lawnmower -- irc.Geekshed.net #Script-Help
menu Channel,Status {
.$iif($group(#dramatica) == On,$style(1)) Encyclopedia Dramatica Trigger
..$iif($group(#dramatica) == On,$style(2)) On: .enable #dramatica
..$iif($group(#dramatica) == Off,$style(2)) Off: .disable #dramatica
}
#dramatica on
On $*:Text:/^(!|@)dramatica.*/Si:#: {
if ($timer($+(dramatica,$network,$nick))) { return }
.timer $+ $+(dramatica,$network,$nick) 1 4 noop
var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
if (!$sslready) %method ssl not found! Please contact the administrator of this bot and inform him/her of this situation.
else dramaticaS %method $2-
}
#dramatica end
alias dramatica { dramaticaS echo -a $1- }
alias -l dramaticaS {
$1-2 Searching........
var %sockname $+(dramaticaS,$network,$2,$ticks)
sockopen -e %sockname encyclopediadramatica.se 443
sockmark %sockname $1-2 $iif($3,$+(/Special:Search/,$replace($3-,$chr(32),+)),/Special:Random) 0 $iif(!$3,1,0)
}
alias -l dramaticaR {
var %sockname $+(dramaticaR,$network,$2,$ticks)
sockopen -e %sockname encyclopediadramatica.se 443
sockmark %sockname $1-2 $+(/,$3) 0 $iif($4,1,0)
}
On *:sockopen:dramatica*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: encyclopediadramatica.se
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:dramaticaS*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %dramaticaS | sockread %dramaticaS
if (Page title matches isincs %dramaticaS) { sockmark $sockname $puttok($sock($sockname).mark,1,4,32) }
if (Page text matches isincs %dramaticaS) { sockmark $sockname $puttok($sock($sockname).mark,1,4,32) }
if ($gettok($sock($sockname).mark,4,32)) && ($regex(%dramaticaS,/\Q<li><a href="/\E(.*)\Q" title="\E/)) {
dramaticaR $gettok($sock($sockname).mark,1-2,32) $regml(1) $gettok($sock($sockname).mark,5,32)
sockclose $sockname
return
}
if (Location: isin %dramaticaS) {
dramaticaR $gettok($sock($sockname).mark,1-2,32) $nopath(%dramaticaS) $gettok($sock($sockname).mark,5,32)
sockclose $sockname
return
}
}
}
On *:sockread:dramaticaR*: {
if ($sockerr) { echo -st socket error $nopath($script) }
else {
var %dramaticaR | sockread %dramaticaR
if (ED FORUMS !isincs %dramaticaR) {
if (*<p>*<b>* iswm %dramaticaR) || (*<p>*<i>* iswm %dramaticaR) {
sockmark $sockname $puttok($sock($sockname).mark,$calc($gettok($sock($sockname).mark,4,32) + 1),4,32)
}
if ($gettok($sock($sockname).mark,4,32)) && ($httpstrip(%dramaticaR)) {
put $gettok($sock($sockname).mark,1-2,32) $v1 $+(,http://encyclopediadramatica.se,$gettok($sock($sockname).mark,3,32))
sockclose $sockname
return
}
}
}
}
On *:sockclose:dramatica*: {
if ($gettok($sock($sockname).mark,5,32)) && (dramaticaR* iswm $sockname) { dramaticaS $gettok($sock($sockname).mark,1-2,32) }
else { $gettok($sock($sockname).mark,1-2,32) Sorry No results found for your Search }
}
alias -l httpstrip { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x) | return $remove($replace(%x,&amp;,&),&nbsp;,&lt;) }
alias -l Put {
if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text | return }
var %tokens $0, %Tstart 3, %Dtimer 1500
if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }
while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
dec %tokens
if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
.timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
inc %Dtimer 1500
%Tstart = $calc(%tokens + 1)
%tokens = $0
}
}
.timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
.timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop
}

Comments

Sign in to comment.
ovelayer   -  Sep 17, 2013
doesn't seem to work
[Tue 1:46:17pm] Socket Error dramatica.mrc
$true
 Respond  
PackardBell   -  Jun 16, 2013
@FordLawnmower i get this one : [16/06/13|13:56:56] Socket Error dramatica
:/
FordLawnmower  -  Jun 16, 2013
@PackardBell , @MashhitDK This script is now updated and working.
*Update* This script now requires https so you must install Openssl to use this script.
Download and install OpenSSL: http://www.mirc.com/download/openssl/openssl-0.9.8r-setup.exe
If you are not sure if you already have Openssl installed, type //echo -ga $sslready
If it returns $true, you are fine. Otherwise you must install Openssl.
Sign in to comment

MashhitDK   -  Jun 29, 2012
Any fix for this... just added but can see site has moved to .se
Or am guessing it has... but didn't work changing the host to .se
 Respond  
Frenetic   -  Sep 03, 2011
Shame this isn't for TCL, looks good. But anyway, nice script. :)
 Respond  
FordLawnmower   -  Sep 03, 2011
Thanks MashhitDK :)
Check the Updated code at the top.
Just posted a bug fix because of site changes.
 Respond  
MashhitDK   -  Sep 03, 2011
Just wanted to say thanks... nice script... some of the outputs are 2 funny.
 Respond  
irchainscriptz   -  Jun 30, 2011
Nice snippet!! Will try it on saturday!!
 Respond  
toclafane1   -  Jun 30, 2011
:) i decided to try it and see :P
 Respond  
FordLawnmower   -  Jun 29, 2011
Thanks for the info uneek :)
Thanks for the confirmation toclafane1 :)
Updated and working.
 Respond  
toclafane1   -  Jun 27, 2011
i switched the URL to encyclopediadramatica.ch

and it worked i think

[3:31pm] <04~toclafane> @dramatica
[3:31pm] <03&ThunderBolt> Searching........
[3:31pm] <03&ThunderBolt> Muzz, a.k.a. Shelley Eve, is a furry artist who specializes in perfectly proportionate anatomy as seen in her lovely art. Her favorite past times include going on deletion sprees all over the internets after she has been told that she is a bitch. She has done this many times, and can be seen throughout her galleries as all of them are as full as a black person's pantry. In a further effort
[3:31pm] <03&ThunderBolt> to prove that she is an adult that
[3:31pm] <03&ThunderBolt> can handle criticism she also got a sock puppet account here at ED and tried to blank this page. http://encyclopediadramatica.com/Muzz
 Respond  
uneek   -  Jun 25, 2011
new ED website is at encyclopediadramatica.ch

can probably just switch urls, as it was ported over verbatim.
 Respond  
toclafane1   -  Apr 30, 2011
ok no problem
 Respond  
FordLawnmower   -  Apr 30, 2011
Looks like it's broken toclafane1. Just unload it and I will try to get a fix in a few days.
 Respond  
toclafane1   -  Apr 30, 2011
when i loadedthis script and typed !dramatica it flooded me out any ideas
 Respond  
FordLawnmower   -  May 29, 2010
I laughed my @#$% off when I saw this -->> http://encyclopediadramatica.com/Hawkee
 Respond  
FordLawnmower   -  Sep 18, 2009
O.O Interesting, I didn't know that.
 Respond  
weishaupt   -  Sep 18, 2009
other than contributing, no. but when you know the history, you know that uncyc is a cheap rip off made my disgruntled and banned dramatica users. also, for better (though vulgar) documentation, ED has a 20:1 ratio on total articles written.
 Respond  
FordLawnmower   -  Sep 16, 2009
o.O Do you have some affiliation with encyclopedia dramatica weishaupt?
 Respond  
weishaupt   -  Sep 16, 2009
uncyclopedia is the poor man's encyclopedia dramatica.
 Respond  
FordLawnmower   -  Sep 16, 2009
Updated Code to consistently give a random result.
 Respond  
FordLawnmower   -  Sep 16, 2009
You're probably right ^Neptune. I had never even heard of encyclopediadramatica until a few days ago. It's still pretty funny though :D
!Uncyclopedia -->> http://www.hawkee.com/snippet/6710/
 Respond  
^Neptune   -  Sep 16, 2009
Cool. But uncyclopedia is better. :P
 Respond  
FordLawnmower   -  Sep 15, 2009
**Updated**
I changed the search engine a little to render more results and to fix case sensitivity issue.
*********
 Respond  
FordLawnmower   -  Sep 15, 2009
@PATX Thanks :)
@weishaupt I'm working on a bug fix for it anyway. It's as much an issue of case sensitivity as anything.
I'll make some changes in the script so it will try to find results no matter what.
 Respond  
weishaupt   -  Sep 15, 2009
whoops! sorry Ford, this does work with multiple search terms...you just have to use the underscore. so concerned women would be Concerned_Women

thanks, excellent job!
 Respond  
PATX   -  Sep 15, 2009
i like it...
 Respond  
weishaupt   -  Sep 15, 2009
thanks for this. one thing i noticed, it will not pull info on search terms that have multiple words in their title. "concerned women" will not give you the echo information, but "boxxy" will.
 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.