R77 Community Forum Archive

Programming => Scripting => Requests => Topic started by: EKLIPz on March 08, 2009, 08:21:18 PM

Title: Google Script
Post by: EKLIPz on March 08, 2009, 08:21:18 PM
Quote from: EKLIPz
I am looking for a plugin that can use google to do a few things. If possible, these are the commands I would like.

Me: !gstats <search phrase>  // Displays how many results are found for a given search.
Bot: Results 1 - 10 of about 200,000 for <search phrase>. (0.10 seconds)

Me: !gsearch <search phrase>  // Displays top 3 links for search.
Bot: Link 1 -- www.link1.com
Bot: Link 2 -- www.link2.com
Bot: Link 3 -- www.link3.com

Me: !gsearch [fl] <search phrase>  // Displays link for First Link aka Feeling Lucky
Bot: Link 1 -- www.link1.com

Me: !gplink  // Takes last searched link, and inputs it into bot's profile.
Bot: Added link to profile.


Also, this will more then likely need some kind of flood control, to keep it from spamming or being abused. Thanks to whoever can do this.

Title: Google Script
Post by: Vector on March 09, 2009, 11:15:13 AM
Ahhh, the infamous google plugin. They don't like scInet, but I have a workaround.

Did ya check /r77 get googphone yet? I wrote one that could retrieve stats for a particular phone number xD

But yah, when I can, I will work on this.
Title: Google Script
Post by: EKLIPz on March 09, 2009, 12:07:05 PM
Yea, I am very fond of the googphone plugin.  Only thing that sucks, is 89% of the PN I try aren't in the database. Cell phone and Canadian #s don't work.

I also love fpFunPlugin.plug.  Idk how it works, but that thing is "semi" close to what I want with this google plugin. Where, you ask it stuff, and it retrieves info from google. But can also get data on searches. But the fun plugin is super fast, which, I doubt the google plugin will be as fast, seeing as it has to actually google.
Title: Google Script
Post by: Vector on March 09, 2009, 12:57:57 PM
The queries into the google database are relatively fast. Only querying the search URL won't be as fast as querying a URL that doesn't require retrieval of information in a database.
Title: Google Script
Post by: Ace on March 10, 2009, 01:12:14 PM
A. We didn't forget about it, it couldn't have been done easily.
B. Would other search engines work? (ex. Dogpile?)
Title: Google Script
Post by: EKLIPz on March 10, 2009, 01:14:17 PM
Nope. It's a google bot. (Googlism@USEast)

And Joel is kindly already working on it. I saw some working tests earlier today.

Thanks tho. If you want to make a "Dogpile" script, that is fine. But Google > *
Title: Google Script
Post by: Vector on March 11, 2009, 10:39:14 AM
I was in the process of working on flood protection for it, but I'll get to testing it later on.
Title: Google Script
Post by: EKLIPz on March 11, 2009, 08:46:13 PM
[size=]GoogleGnome[/size]

This is kind of my way at attempting to learn VBS. I am not sure on all of the details, but, here is what I got so far.

GoogleGnome, much like the previous and current Gnomes, will go from channel to channel, collecting data. It will begin with very few channels. The data being collected is undetermined. I am trying to come up with something google related. If anyone can come up with and ideas, that would be great. Like I stated b4, this is a project for me to get an understanding of VBS and just the bot in general. I have never written a script, so, all help would be helpful. I have quite a few tutorials and help sites I am going by, and just generally looking at existing scripts to get some knowledge. If anyone is bored, and has time to blow, maybe I can get someone that knows VBS some to partner up with.

On to the script. My current tasks are creating a "GGnome" mode that will start its travel to channels.

This is the script I have so far.

Code: [Select]
'gg
'1.0
'&GoogleGnome Plugin By EKLIPz
'&
'&
'&My Scipting project.

Sub gg_Event_Load()
    AddChat vbGreen, "EKLIPz' GoogleGnome v.01 plugin loaded."
End Sub

Sub blank_Event_Close()
    AddChat vbCyan, "GoogleGnome closing."
End Sub

**Remember, this is not a request, I am not looking for someone to make this for me. Any help or tips is fine, and maybe a partner, but, other then that, this is my project.
Title: Google Script
Post by: EKLIPz on March 11, 2009, 10:11:11 PM
Well, I skipped a step, and have set up a MySQL table for a channel list to visit. And A form for people to add their channel. Maybe eventually I will add something different, so I don't have random people adding channels, but this is fine for now. And once I get it all set up, maybe the bot can read from the DB on which channels to visit.

http://ekreationz.comuf.com/ggnome.php (http://ekreationz.comuf.com/ggnome.php)
Title: Google Script
Post by: Reason on March 12, 2009, 05:40:44 AM
With all the gnome scripts around, I might make one of my own, FailGnome!
Title: Google Script
Post by: Hale_ on March 13, 2009, 06:38:04 AM
Don't create two Threads with the same thing. Merged Topics.
Title: Google Script
Post by: EKLIPz on March 13, 2009, 10:06:06 AM
Two totally different topics...ideas...and, ideas. Google Script is a plugin for searching google, which was a request, and Joel is working on it.

The Gnome was a project for me....and anyone that wanted to help, making it a "Group Project". And it was to help me learn VBS.

 Should not have been merged.
Title: Google Script
Post by: Hale_ on March 13, 2009, 08:05:05 PM
It was two topics about the same thing. This one you just requested it and you requested it in the other one too, which kind of makes it the same thing.
Title: Google Script
Post by: EKLIPz on March 13, 2009, 08:22:38 PM
No, one was a project for a gnome bot, one was a request for a google search. Totally different.
Title: Google Script
Post by: Vector on March 14, 2009, 09:25:54 AM
Gah, I feel like tardiness will cost me one.

Try this out. So far, it just returns results, with a link to each result:

Code: [Select]
'gp
'0.1
'&Google Plugin:Vector:Searches google, and returns the results of the search
'*
'*
'*
'*
'*Fun

Const gpAcc = 20

Public xmlGet, arrFloodProtect

Sub gp_Event_Load()
  Set xmlGet = CreateObject("Microsoft.XmlHttp")
End Sub

Sub gp_Event_UserTalk(Username, Flags, Message, Ping)
  GetDBEntry Username, a, f : If a < gpAcc Then Exit Sub

  If Left(Message, Len(BotVars.Trigger) + 6) = BotVars.Trigger & "gfind " Then
    getQuery = Right(Message, Len(Message) - (Len(BotVars.Trigger) + 6))
    getQuery = Replace(getQuery, " ", "+")
    Call retrieveResult(getQuery)
  End If
End Sub

Sub retrieveResult(getQuery)
  xmlGet.Open "GET", "http://www.google.com/search?hl=en&q="&getQuery&"&btnG=Google+Search&aq=f&oq=", False
  xmlGet.Send ""

  content = xmlGet.ResponseText

  getNumResults = Split(Split(content, "Results ")(1), "&nbsp;</div>")(0)
  getNumResults = strip(getNumResults)
  AddQ getNumResults

  parseResults = Split(Split(content, "Search Results")(1), "http://")

  idx = -1
  For i=0 to Ubound(parseResults)
    getLink = Split(parseResults(i), """")(0)

    If Len(getLink) > 25 Then
      getLink = "http://" & Split(getLink, "/")(0) & " [link truncated]"
    Else
      getLink = "http://" & getLink
    End If

    If InStr(parseResults(i), "this.href,'','','res'") Then
      getText = Split(parseResults(i), "this.href,'','','res'")(1)
      getText = Split(getText, "</a>")(1)
      getText = Replace(getText, "<a href""", "")
      getText = Strip(getText)
      getText = Trim(Left(getText, Len(getText) - 9))
      If Len(getText) > 140 Then getText = Left(getText, 140) & " ..."
      getElem = getText & " Link: " & getLink

      idx = idx + 1
      ReDim Preserve arrFloodProtection(idx)
      arrFloodProtection(idx) = getElem
    End If
  Next

  For i=0 to Ubound(arrFloodProtection)
    AddQ arrFloodProtection(i)
  Next
End Sub

Function strip(parseOutChars)
  tagF = Array("&quot;", "<b>", "</b>")
  tagR = Array("""", "", "")

  getTagCount = Ubound(Split(parseOutChars, "<"))

  For i=1 to getTagCount
    getTag = Split(Split(parseOutChars, "<")(i), ">")(0)
    parseOutChars = Replace(parseOutChars, getTag, vbNullString, 1, 1)
  Next
  parseOutChars = Replace(parseOutChars, "<>", vbNullString)

  i = 0
  For each tag in tagF
    parseOutChars = Replace(parseOutChars, tag, tagR(i))
    i = i + 1
  Next

  strip = parseOutChars
End Function
Title: Google Script
Post by: riffruff on March 14, 2009, 06:54:21 PM
Quote from: Hale_
It was two topics about the same thing. This one you just requested it and you requested it in the other one too, which kind of makes it the same thing.
Silly hale...
Title: Google Script
Post by: Reason on March 14, 2009, 09:11:33 PM
Double Posts are for Admins
Title: Google Script
Post by: Ace on March 15, 2009, 06:25:02 AM
Should we be posting gnome scripts that annoy the crap out of people sometimes?  For the amount of people we could get, I go against it.  You can send it via PM.