[mIRC Sockets] Google script

Release your script here.
State:
- Author
- What it does
- Perhaps a little guide.
- Also, if the snippet is of any use to the community, it has a chance of getting posted on the main page, so don't hesitate to submit/ask!

[mIRC Sockets] Google script

Postby SilverRain » Fri Jul 25, 2008 4:00 pm

Code: Select all
on *:TEXT:!google*:#: { 
        if (!$2) { notice $nick Syntax: $1 <google search string> }
        else {
          notice $nick Connecting..
        var %s = google. $+ $ticks | sockopen %s http://www.google.co.uk 80 | sockmark %s $replace($1-,$chr(32),+) 1 1   $chan
      }
}
on *:sockopen:google.*:{
  tokenize 32 $sock($sockname).mark
  if ($sockerr) { echo -at  Google: Unable to open connection to google.co.uk $sock($sockname).wsmsg | halt }
  var %s = sockwrite -n $sockname
  %s GET /search?hl=en&q= $+ $1 $+ &btnI=Google+Search&meta= HTTP/1.0
  %s Host: http://www.google.co.uk
  %s User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
  %s Connection: keep-alive
  %s $crlf
}

on *:sockread:google.*:{
  tokenize 32 $gettok($sock($sockname).mark,1,32)
  var %all
  sockread %all
  if (Location: * iswm %all) {
    msg $gettok($sock($sockname).mark,2,32) First result for $replace($1,+,$chr(32)) $remove(%all,Location:,$chr(32)))
    sockclose $sockname
  }
  if (Your search* *did not match any documents iswm %all) {
    msg $gettok($sock($sockname).mark,2,32) Google: No results for $+(",$replace($1,+,$chr(32)),",)
    sockclose $sockname
  }
}
SilverRain
 

Re: [mIRC Sockets] Google script

Postby Lukemob » Sat Jul 26, 2008 4:56 pm

One thing is, people really like making a google scripts.. what causes there are too many. But thanks for this one, as it's the first on our forum :-)
Lukemob
 

Re: [mIRC Sockets] Google script

Postby Dandy » Tue Jul 29, 2008 8:54 pm

Nice script

This is not import or things that I don't like just things that got into my mind then i read the script ;)
- You should use HTTP/1.1 instead of 1.0
- As you are using the Location header to find the result you can use HEAD instead of GET, that way you will only receive the headers and not the fullpage.

But keep up the good work ;)
Dandy
 

Re: [mIRC Sockets] Google script

Postby Futz0r » Mon Jul 13, 2009 2:40 pm

•• 16:40:40 •• <+Futz0r> !google Futz0r
•• 16:40:40 •• Google: Unable to open connection to google.co.uk [0] Unknown Error
Futz0r
 


Return to Mirc Scripting Release

Who is online

Users browsing this forum: No registered users and 0 guests

cron