What The Fuck Should I Watch Tonight?
Platform: mIRC
Published Oct 28, 2011
Updated Oct 28, 2011
This is a quick socket snippet to the site
http://!@#$.com, a site that offers a php script that randomly picks a movie and generates a Netflix link for you, along with a witty message.
Usage: !watch
(01:26:58 pm) <~hxck> !watch
(01:26:59 pm) <~Victoria> I'd say watch paint dry, but that wouldn't be helpful. How about some !@#$: Highlander: Endgame (2000) ::
http://www.netflix.com/Movie/Highlander_Endgame/60001865
Enjoy!
on $*:TEXT:/^!watch$/Si:#: {
sockopen wtfw !@#$.com 80
sockmark wtfw msg #
}
on *:SOCKOPEN:wtfw: {
sockwrite -n $sockname GET /get_movie.php HTTP/1.1
sockwrite -n $sockname Host: !@#$.com
sockwrite -n $sockname Connection: close
sockwrite -n $sockname $crlf
}
on *:SOCKREAD:wtfw: {
if ($sockerr) { $sock(wtfw).mark Socket Error: $sock(wtfw).wsmsg }
var %wtfwtemp
sockread %wtfwtemp
if (<p id="intro" isin %wtfwtemp) { set %wtfwline $remove($gettok(%wtfwtemp,3-,32),class="cufon">,</p>,<br />) }
if (<h1 class=" isin %wtfwtemp) {
set %wtfwlink $replace($remove(%wtfwtemp,$left(%wtfwtemp,27),$right(%wtfwtemp,9)),">,$chr(32))
tokenize 32 %wtfwlink
}
}
on *:SOCKCLOSE:wtfw: {
$sock(wtfw).mark %wtfwline $+ : $gettok(%wtfwlink,2-,32) :: $gettok(%wtfwlink,1,32)
}