jdelaney Posted April 26, 2013 Share Posted April 26, 2013 (edited) I have no clue...the samples provided have no node with .id = StoreList1 edit: would you post a bit of the html? I'd prefer not to open unknown links If the store names are directly under this node: if $odiv.id = '"storeList1"' then consolewrite($odiv.outertext & @lf) then modify to this: If $odiv.id = '"storeList1"' Then For $oChild In $odiv.childnodes ConsoleWrite($oChild.innertext & @CRLF) Next EndIf ; or output to array If $odiv.id = '"storeList1"' Then $oStoreCol = $odiv.childnodes Local $aStores[$oStoreCol.length] $iCounter = 0 For $oChild In $oStoreCol $aStores[$iCounter] = $oChild.innertext $iCounter+=1 Next _ArrayDisplay($aStores) EndIf Edited April 26, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
kylomas Posted April 26, 2013 Share Posted April 26, 2013 @jdelaney - Iterating the childnodes got everything except what I'm looking for. More info: When I view source from the "View" toolbar in IE I cannot see any of this HTML. I can navigate to the node(s) I'm trying to get using "DebugBar" or "Developer Tools" (F12 in IE). Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
kylomas Posted April 26, 2013 Share Posted April 26, 2013 (edited) @jdelaney, I have a file produced by expandcollapse popup#include <array.au3> #include <ie.au3> #include <string.au3> _IEErrorHandlerRegister("ERR") local $odiv, $odivs, $url $url = 'http://www.acehardware.com/mystore/storeLocator.jsp#53214|null' return_addresses($url) func return_addresses($url) local $str,$aADDR local $oIE = _IECreate($url,0,0) _IELoadWait($oIE) filewrite(@scriptdir & '\body.txt',_IEBodyReadHTML($oIE)) ;~ local $odivs = _IETagNameGetCollection($oIE,'div') ;~ for $odiv in $odivs ;~ if $odiv.id = '"storeList1"' then ;~ For $oChild In $odiv.childnodes ;~ ConsoleWrite($oChild.innertext & @CRLF) ;~ Next ;~ endif ;~ next _IEQuit($oIE) $oIE = 0 endfunc Func ERR() consolewrite(StringStripWS($oIEErrorHandler.WinDescription, 2) & @lf) ConsoleWrite('Id = ' & $odiv.id & @LF) ConsoleWrite('Title = ' & $odiv.title & @LF) ConsoleWrite('Class = ' & $odiv.classname & @LF) ConsoleWrite(_stringrepeat('*',100) & @LF) Return EndFunc How can I upload it so you can look at it? Edited April 26, 2013 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
allSystemsGo Posted April 26, 2013 Author Share Posted April 26, 2013 It's like whatever this site uses to generate its results is not easily found in the source. I've made two scripts already that do this same thing, except they were relatively easy to navigate. This one has been a thinker. There is a results div, with no code, no reference to any data.. Link to comment Share on other sites More sharing options...
iamtheky Posted April 26, 2013 Share Posted April 26, 2013 (edited) Your issue made me curious, but i went down a different pathYou need an API key from google (which is free)and JSMN from expandcollapse popup#Include "JSMN.au3" #Include <Array.au3> #Include <File.au3> Global $aFarray $input = inputbox("Ace Hardware Finder" , "Enter Location" , "City State Address or Zip") $location = stringreplace($input , " " , "+") Local $Json = BinaryToString(InetRead("https://maps.googleapis.com/maps/api/place/textsearch/json?query=Ace+Hardware+"&$location&"&sensor=true&key=<YOUR KEY HERE>"), 4) Local $Obj = Jsmn_Decode($Json) $file = fileopen(@ScriptDir & "\JSON_RADIUS_OUTPUT.txt" , 2) filewrite($file , Jsmn_Encode($Obj, $JSMN_PRETTY_PRINT)) fileclose($file) _FileReadToArray(@ScriptDir & "\JSON_RADIUS_OUTPUT.txt" , $aFarray) For $i = $aFarray[0] to 1 step -1 If stringinstr($aFarray[$i] , '"formatted_address": ') or stringinstr($aFarray[$i] , '"name": ') Then ContinueLoop Else _ArrayDelete($aFarray , $i) Endif next _ArrayDelete($aFarray , 0) $results = Fileopen(@ScriptDir & "\results.txt" , 2) for $j = 0 to ubound($aFArray) - 1 step 2 If stringinstr($aFarray[$j+1] , "Ace Hardware") or stringinstr($aFarray[$j+1] , "Ace Hdw") Then filewrite($results , stringtrimright(stringtrimleft($aFArray[$j+1], 11),1)) filewrite($results , @CRLF) filewrite($results , stringtrimright(stringtrimleft($aFArray[$j], 24),1)) filewrite($results , @CRLF) filewrite($results , @CRLF) Endif Next FileClose ($results) shellexecute(@ScriptDir & "\results.txt")using this solution for my zip code returns a text file that looks like:"Keith's Ace Hardware" "213 Mill Creek Drive, Salado, TX, United States" "Ace Hdw at Cedar Park" "200 South Bell Boulevard, Cedar Park, TX, United States" "Ace Hardware" "7708 Lohmans Ford Road, Lago Vista, TX, United States" "Keith's Ace Hardware" "201 S Frontage Rd, Lorena, TX, United States" "Keith's Ace Hardware" "408 West McGregor Drive, McGregor, TX, United States" "Ace Hardware" "1390 North Houston Street, Lorena, TX, United States" Edited April 26, 2013 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
allSystemsGo Posted April 26, 2013 Author Share Posted April 26, 2013 (edited) Where would I get this Key? edit: I see where to get it...but is it really free? It has pricing..? edit # 2: I should read the fine print. Edited April 26, 2013 by allSystemsGo Link to comment Share on other sites More sharing options...
iamtheky Posted April 26, 2013 Share Posted April 26, 2013 https://developers.google.com/places/documentation/the authentication section will walk you through it ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
allSystemsGo Posted April 26, 2013 Author Share Posted April 26, 2013 Got my key. Put my key where it should go. Ran the code... Empty Results.txt file. Link to comment Share on other sites More sharing options...
iamtheky Posted April 26, 2013 Share Posted April 26, 2013 (edited) see if the output.txt is empty too. in your google developer console go to services, kick on all the maps and places. Then go to api access and make sure you are using the API key from "Simple API Access" While you are just testing for output you could run with #Include "JSMN.au3" $input = inputbox("Ace Hardware Finder" , "Enter Location" , "City State Address or Zip") $location = stringreplace($input , " " , "+") Local $Json = BinaryToString(InetRead("https://maps.googleapis.com/maps/api/place/textsearch/json?query=Ace+Hardware+"&$location&"&sensor=true&key=<KEY>"), 4) Local $Obj = Jsmn_Decode($Json) consolewrite(Jsmn_Encode($Obj, $JSMN_PRETTY_PRINT)) until you get data Edited April 26, 2013 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
allSystemsGo Posted April 26, 2013 Author Share Posted April 26, 2013 This is in the output.txt { "html_attributions": [], "results": [], "status": "REQUEST_DENIED" } Link to comment Share on other sites More sharing options...
iamtheky Posted April 26, 2013 Share Posted April 26, 2013 yeah i was editing the crap out of post #29 while you were posting that, sorry. Its just the key, It took a couple of minutes for mine to work, and couple of minutes of me putting in everything but the API key under Simple API Access. Should be a 40ish character AlphaNumeric string. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
allSystemsGo Posted May 1, 2013 Author Share Posted May 1, 2013 This still does not work for me... Link to comment Share on other sites More sharing options...
iamtheky Posted May 1, 2013 Share Posted May 1, 2013 Sux, I have been further playing with radius queries via this method and it seems like a very reusable snippet for locationplace based searches. In your google API console, can you verify the services displayed in the far right pane of your overview (and that they are green 'No known issues'); and under API Access you only have "Simple API Access" and are using the API key from that section. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
allSystemsGo Posted May 1, 2013 Author Share Posted May 1, 2013 Here are a couple of screenshots.. Link to comment Share on other sites More sharing options...
iamtheky Posted May 1, 2013 Share Posted May 1, 2013 (edited) You dont have the Places API listed.edit: I posted an example that uses places details to capture phone number as well. It needs refinement of its own and did not want to derail this thread any further than i already managed to. Edited May 1, 2013 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now