What The Fuck Should I Watch Tonight?

By hxck
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)
}

Comments

Sign in to comment.
cptpan   -  Sep 22, 2012
This is great, but sometimes the wording returns broken HTML:

I'd say watch paint dry, but that <br />wouldn't be helpful. How about some !@#$:

Didn't that last movie you watch <br />!@#$ suck? Try this:
 Respond  
toclafane1   -  Oct 29, 2011
Hahahah, so true
 Respond  
Jethro   -  Oct 29, 2011
I know it ain't easy, but there are times we have to lose some, gain some.

Apologies, hxck, for kidnapping your thread for off-topic comments.
 Respond  
toclafane1   -  Oct 29, 2011
Well i guess i will have to make some more interesting comments :P
 Respond  
Jethro   -  Oct 29, 2011
Yeah you're right, toclafane1. I thought the likes would stick, but I was wrong about that. lol I suppose I have too many likes; I lost count myself. Don't fret over it, your likes will increase over time.
 Respond  
toclafane1   -  Oct 29, 2011
So, why do i have 58, when i clearly had 65 yesterday?
 Respond  
Jethro   -  Oct 29, 2011
The flaming posts were removed, toclafane1, but your likes remained intact.
 Respond  
toclafane1   -  Oct 29, 2011
Nice Snippet 8/10, and i was was wondering where all my likes had gone, they were removed :(
 Respond  
Jethro   -  Oct 29, 2011
You know, you should be able to combine another socket, the one called "for dinnner" with this one as one script. You can open as many sockets as you like within one script. Not to mention you use the on text regex...why not make the most of it?
 Respond  
MashhitDK   -  Oct 28, 2011
LoL... I like the idea... N1
 Respond  
hxck   -  Oct 28, 2011
I know that now, I just have some leftovers in old snippets, and when I put together small things like this I just copy and paste old sockets and modify them.
 Respond  
Jethro   -  Oct 28, 2011
If you're gonna use the tokenize command for the receiving buffer in the %wtfwlink variable, you should've used $1, $2, $3, etc..etc...to match for the token you intend to match. That is to say you have to know the exact position of the buffer. For example, let's say the source code contains these phrase: hxck has made a socket script.

You tokenize it to get the value you want to match.

Code

 
What tokenize does is, in a simplest explanation, is to break up the words within a sentence.
 Respond  
hxck   -  Oct 28, 2011
Habit from the person that taught me.
 Respond  
Jethro   -  Oct 28, 2011
The command

Quote

tokenize 32 %wtfwtemp
is purposeless in the snippet. I'm not certain what makes you use it in the first place.
 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.