Jump to content



Photo

_google()


  • Please log in to reply
17 replies to this topic

#1 w0uter

w0uter

    resreveR nA

  • Active Members
  • PipPipPipPipPipPip
  • 2,262 posts

Posted 03 June 2005 - 03:34 PM

when i tried to use the _INetGetSource() UDF on google.com/search?
it got mad at me for violating the rules. (some stuff about no bot searches).
so i made this.

it return the first 10 (unless you specified diff @ google) links about the search param's

ex usage $array = _Google('autoitscript')

$array[0] = number of links.
$array[1-10] = links.

HTML         
Func _Google($s_q)<br />     <br /> ;locals<br />     Local $s_temp, $s_IE, $o_IE, $as_ret = ''<br />     <br />     $o_IE = ObjCreate ("InternetExplorer.Application")<br />     $o_IE.Navigate ('http://www.google.com/search?q=' & $s_q)<br />    While $o_IE.busy<br />        Sleep(10)<br />    WEnd<br />    $s_IE = $o_IE.document.body.innerHTML<br />    $s_IE = StringRegExp($s_IE, "<A(.*?)>", 3)<br />    <br />    For $i_count = 0 To UBound($s_IE) - 1<br />        $s_temp = StringLeft($s_IE[$i_count], StringInStr($s_IE[$i_count], '"', 0, -1) - 1)<br />        $s_temp = StringReplace(StringTrimLeft($s_temp, StringInStr($s_temp, '"', 0, -1)), '&amp;', '&')<br />        If StringLeft($s_temp, 1) = '/' Or StringInStr($s_temp, 'google') Or StringInStr($s_temp, 'cache') Then ContinueLoop<br />        <br />        $as_ret &= $s_temp & '&*|&%'<br />        <br />    Next<br />    <br />    $as_ret = StringTrimRight($as_ret, 5)<br />    <br />    $as_ret = StringSplit($as_ret, '&*|&%', 1)<br />    <br />    Return $as_ret<br />    <br /> EndFunc  ;==>_Google

Edited by w0uter, 19 August 2005 - 11:16 PM.

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll





#2 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,163 posts

Posted 03 June 2005 - 06:40 PM

Hey that's pretty cool actually.

#3 MrSpacely

MrSpacely

    Polymath

  • Active Members
  • PipPipPipPip
  • 211 posts

Posted 03 June 2005 - 09:17 PM

Great.

But one note to avoid the no bot message try making a new inetget function wich can also send some headers like agent;)

I made a script with mirc (how bad) wich fooled a webcam server that my request send a correct refferer;) Hmm maybe an Idea to make better inetget function wich uses tcp-sockets like I did in mirc (that was really too much work mirc is not really for making tcp scripts but ok)
And have feature the ability to choose headers (like agent referer etc or even send cookies)

Not realy difficult even if you donot have access to rfc's you can make a simple telnet like server and let a webbrowser connect to it to receive the codes you need (like the agent you want to imitate)

Thanks now I got a idea for myself ofcourse can add in a feature to get google search results (allready have few wich get weather and whats on tv for some chat using normal inetget)

The normal inetget gave me the same problems with result because it doens't accept cookies. Some websites really want to send those need to make that too. (hmm how does that work _google("rfc http"))

It seems the normal inetget function just uses a buildin function of internet explorer

Edited by MrSpacely, 03 June 2005 - 09:24 PM.


#4 therks

therks

    Witty quote

  • Active Members
  • PipPipPipPipPipPip
  • 2,163 posts

Posted 04 June 2005 - 11:58 PM

Wow, you must have gigantic lung capacity to be able to speak so long without taking a breath (only one period in that whole post! :().

I would guess you're right about InetGet using Internet Explorer, seeing as the help file even specifies, "Internet Explorer 3 or greater must be installed for this function to work."

Considering your experience with TCP, perhaps you could write a UDF-style InetGet using the now built-in (beta version only, I believe) TCP functions.

#5 MrSpacely

MrSpacely

    Polymath

  • Active Members
  • PipPipPipPip
  • 211 posts

Posted 05 September 2005 - 12:06 PM

Wow, you must have gigantic lung capacity to be able to speak so long without taking a breath (only one period in that whole post! :whistle:).

I would guess you're right about InetGet using Internet Explorer, seeing as the help file even specifies, "Internet Explorer 3 or greater must be installed for this function to work."

Considering your experience with TCP, perhaps you could write a UDF-style InetGet using the now built-in (beta version only, I believe) TCP functions.

<{POST_SNAPBACK}>

lol Indeed I speak verry long time;)

But i could create a new inetget function I was getting to It but found that autoit cannot handle NULL chars in strings or when writing files.
Wich really sucks for making inetget function except if you only want to get text data.

But I could still make it so it can handle text data can be usefull if you want to get weather info or news to your program function.
I used that info for a bot on irc wich could say the weather time and what was on tv. Only it was a half bot it typed in the chatbox. obviously its possible to make a irc client. Wich I did once in mirc make a irc client in mirc script using those sockets functions.

Mirc does have a little thing wich is better It does handle Null chars correctly because it has Bwrite and Bread and special variables. But its also much slower and not really portable as autoit script. ALso mirc cannot really work with multiple sockets because you cannot put sockets in a array there.

So i hope autoit will have binary (files and strings with NULL chars) support really soon then you can make even more things. Also a fully working inetget with header support and binary support. Maybe even more extra things like a textfilter wich can find certain parts of the text if they fixed the bug in regexp wich did not work correctly:S really anoying if you want to filter text and it sometimes doesn't understand the . operator correctly. (mental note test new beta with regexp see it fixed(note noted))

#6 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 18 May 2006 - 07:32 PM

Hey this looks cool but I get this error:

C:\Documents and Settings\war_driver\Desktop\_google.au3 (11) : ==> Variable must be of type "Object".:
$s_IE = $o_IE.document.body.innerHTML
$s_IE = $o_IE.document.body^ ERROR

heres my code:

#include <_google.au3>
#include <array.au3>
$array = _Google("zerocool ")
_ArrayDisplay($array, "")

Am I doing something wrong??

Thanks

#7 w0uter

w0uter

    resreveR nA

  • Active Members
  • PipPipPipPipPipPip
  • 2,262 posts

Posted 18 May 2006 - 08:10 PM

works fine here.

--------------------------- --------------------------- [0] = 10 [1] = <a href='http://www.moviemeter.nl/user/2650' class='bbc_url' title='External link' rel='nofollow external'>http://www.moviemeter.nl/user/2650</a> [2] = <a href='http://www.soccerquest.nl/forum/member.php?u=1797' class='bbc_url' title='External link' rel='nofollow external'>http://www.soccerquest.nl/forum/member.php?u=1797</a> [3] = <a href='http://www.skinbase.org/gallery.php?uname=ZeroCool' class='bbc_url' title='External link' rel='nofollow external'>http://www.skinbase.org/gallery.php?uname=ZeroCool</a> [4] = <a href='http://www.forum.doom9.nl/profile.php?mode=viewprofile&u=80' class='bbc_url' title='External link' rel='nofollow external'>http://www.forum.doom9.nl/profile.php?mode=viewprofile&u=80</a> [5] = <a href='http://www.xboxworld.nl/user/8405' class='bbc_url' title='External link' rel='nofollow external'>http://www.xboxworld.nl/user/8405</a> [6] = <a href='http://www.flashfocus.nl/forum/member.php?u=12426' class='bbc_url' title='External link' rel='nofollow external'>http://www.flashfocus.nl/forum/member.php?u=12426</a> [7] = <a href='http://www.zerocool.it/' class='bbc_url' title='External link' rel='nofollow external'>http://www.zerocool.it/</a> [8] = <a href='http://www.ownage.nl/user/7218/' class='bbc_url' title='External link' rel='nofollow external'>http://www.ownage.nl/user/7218/</a> [9] = <a href='http://www.ownage.nl/user/5943/' class='bbc_url' title='External link' rel='nofollow external'>http://www.ownage.nl/user/5943/</a> [10]    = <a href='http://www.gameqube.nl/users.php?user=5200' class='bbc_url' title='External link' rel='nofollow external'>http://www.gameqube.nl/users.php?user=5200</a> --------------------------- OK   ---------------------------

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

#8 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 19 May 2006 - 03:38 AM

works fine here.

--------------------------- --------------------------- [0] = 10 [1] = http://www.moviemeter.nl/user/2650 [2] = http://www.soccerquest.nl/forum/member.php?u=1797 [3] = http://www.skinbase.org/gallery.php?uname=ZeroCool [4] = http://www.forum.doom9.nl/profile.php?mode=viewprofile&u=80 [5] = http://www.xboxworld.nl/user/8405 [6] = http://www.flashfocus.nl/forum/member.php?u=12426 [7] = http://www.zerocool.it/ [8] = http://www.ownage.nl/user/7218/ [9] = http://www.ownage.nl/user/5943/ [10]    = http://www.gameqube.nl/users.php?user=5200 --------------------------- OK   ---------------------------

Thanks I got it, since I use dial up it skipped the while loop because it didnt do a loadwait, I just put a sleep(100) or so in before the while,
Thanks, and good job

#9 littleclown

littleclown

    Adventurer

  • Active Members
  • PipPip
  • 124 posts

Posted 15 December 2006 - 03:55 PM

This is cool, but many result is "#". Why?

#10 clearguy

clearguy

    Prodigy

  • Active Members
  • PipPipPip
  • 169 posts

Posted 15 December 2006 - 07:08 PM

It is compatible with another navigator as IE ?

#11 FuryCell

FuryCell

    A cornered fox is more dangerous than a jackal!

  • Active Members
  • PipPipPipPipPipPip
  • 2,437 posts

Posted 17 December 2006 - 01:36 AM

It is compatible with another navigator as IE ?


W0uters func uses IEs com interface. It would be difficult and impractical (if not impossible) to use a func like this in a browser like Firefox as it has no com interface.
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

#12 Zach

Zach

    Wayfarer

  • Active Members
  • Pip
  • 68 posts

Posted 30 December 2006 - 07:21 PM

W0uters func uses IEs com interface. It would be difficult and impractical (if not impossible) to use a func like this in a browser like Firefox as it has no com interface.



It may not have a com interface to the browser itself as IE does... but it does have a com control.

#13 geocine

geocine

    Wayfarer

  • Active Members
  • Pip
  • 74 posts

Posted 26 June 2010 - 11:47 AM

Hi my script cannot create a COM object

$o_IE = ObjCreate("InternetExplorer.Application")


Throws up
>Error code: -2146959355

Need some help
Do Not Steal The Government Hates CompetitionO2JAM AutoPlayBot [|||||.............] 10%Friendster Commenter [..................] 0%Auto Message Download Percentage [|||||||||||||||||] 100%

#14 Authenticity

Authenticity

    Universalist

  • MVPs
  • 2,619 posts

Posted 26 June 2010 - 01:20 PM

AutoIt         
#include <Array.au3> Local $aLinks = _Google("AutoIt", 5) If IsArray($aLinks) Then _ArrayDisplay($aLinks) Func _Google($sQuery, $iPages = 1)     Local $oHttpReq = ObjCreate("WinHttp.WinHttpRequest.5.1")     Local $aLinks[11] = [0], $aResult     Local $sResponse     For $i = 1 To $iPages         $oHttpReq.Open("GET", "<a href='http://www.google.com/search?q=' class='bbc_url' title='External link' rel='norewrite nofollow external'>http://www.google.com/search?q="</a> & $sQuery & "start="*($i-1)*10, False)         $oHttpReq.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4")         $oHttpReq.Send         $sResponse = $oHttpReq.ResponseText         If $sResponse = "" Then ExitLoop         $aResult = StringRegExp($sResponse, '(?i)<ol>(.+?)</ol>', 1)         If IsArray($aResult) Then             $aResult = StringRegExp($aResult[0], '(?i)<a href="([^"]+)"[^>]+?class=l', 3)             If IsArray($aResult) Then                 For $j = 0 To UBound($aResult)-1                     $aLinks[0] += 1                     If $aLinks[0] > UBound($aLinks)-1 Then ReDim $aLinks[$aLinks[0]+50]                     $aLinks[$aLinks[0]] = $aResult[$j]                 Next             Else                 ExitLoop             EndIf         Else             ExitLoop         EndIf     Next     If $aLinks[0] = 0 Then Return 0     ReDim $aLinks[$aLinks[0]+1]     Return $aLinks EndFunc


#15 autoall

autoall

    Seeker

  • Active Members
  • 21 posts

Posted 28 August 2011 - 10:46 PM

AutoIt         
#include <Array.au3> Local $aLinks = _Google("AutoIt", 5) If IsArray($aLinks) Then _ArrayDisplay($aLinks)   Func _Google($sQuery, $iPages = 1)     Local $oHttpReq = ObjCreate("WinHttp.WinHttpRequest.5.1")     Local $aLinks[11] = [0], $aResult     Local $sResponse       For $i = 1 To $iPages         $oHttpReq.Open("GET", "<a href='http://www.google.com/search?q=' class='bbc_url' title='External link' rel='nofollow external'>http://www.google.com/search?q="</a> & $sQuery & "start="*($i-1)*10, False)         $oHttpReq.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4")         $oHttpReq.Send         $sResponse = $oHttpReq.ResponseText         If $sResponse = "" Then ExitLoop         $aResult = StringRegExp($sResponse, '(?i)<ol>(.+?)</ol>', 1)         If IsArray($aResult) Then             $aResult = StringRegExp($aResult[0], '(?i)<a href="([^"]+)"[^>]+?class=l', 3)             If IsArray($aResult) Then                 For $j = 0 To UBound($aResult)-1                     $aLinks[0] += 1                     If $aLinks[0] > UBound($aLinks)-1 Then ReDim $aLinks[$aLinks[0]+50]                     $aLinks[$aLinks[0]] = $aResult[$j]                 Next             Else                 ExitLoop             EndIf         Else             ExitLoop         EndIf     Next     If $aLinks[0] = 0 Then Return 0     ReDim $aLinks[$aLinks[0]+1]     Return $aLinks EndFunc


I'm not getting any results form google using this code, maybe a google update?
thanks.

Edited by autoall, 31 August 2011 - 04:12 AM.


#16 MvGulik

MvGulik

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,795 posts

Posted 28 August 2011 - 11:52 PM

I'm not getting any results form google using this code, maybe a google update?
thanks.

Probably. Considering that code is more than a year old.
(suggest you try to drop in a little more info other than a general 'Not working for me'.)

Ps: Don't select the code while adding a automated/icon [code=auto:0] or [autoit] code tag. As it will eat the line-breaks. Just drop the (empty) code tag at the start of the code, and move the closing tag to the end of the code.
(e:That last part was for the old forum ... )

Edited by iEvKI3gv9Wrkd41u, 30 August 2011 - 10:29 AM.

Don't Fall in Love With Ideas"If you fall in love with an idea, you won't see the merits of alternative approaches -- and will probably miss an opportunity or two. One of life's great pleasures is letting go of a previously cherished idea. Then you're free to look for new ones. What part of your idea are you in love with? What would happen if you kissed it goodbye?"

#17 Mikeman27294

Mikeman27294

    Insert Member Title Here

  • Active Members
  • PipPipPipPipPipPip
  • 469 posts

Posted 30 August 2011 - 08:22 AM

Aargh autoall, please word wrap!!!
And yes, if it is old code, then it nearly certainly wont work, and Google will have dropped support for it. Try downloading the latest version. All the functions should work the same, but there will probably more. You shouldnt have any headaches with it, either... if you do it right.
Spoiler


#18 autoall

autoall

    Seeker

  • Active Members
  • 21 posts

Posted 31 August 2011 - 04:16 AM

Aargh autoall, please word wrap!!!
And yes, if it is old code, then it nearly certainly wont work, and Google will have dropped support for it. Try downloading the latest version. All the functions should work the same, but there will probably more. You shouldnt have any headaches with it, either... if you do it right.


Google dropped support? Download?....strange.

I think that G never supported this...

We need to twist some tags, and it will work.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users