Re: A better way to get web data?
Re: A better way to get web data?
- Subject: Re: A better way to get web data?
- From: deivy petrescu <email@hidden>
- Date: Thu, 4 May 2006 21:27:49 -0400
On May 4, 2006, at 10:34, Monte Babington wrote:
I've got a script that retrieves text from a webpage’s HTML. I
need to loop
this function many times. I have two problems:
Problem 1:
Problem #1 is how unbelievably slow it is to do this through
Safari. This
requires that I wait for Safari to open a window, download the source,
format it, and display it. Here's what I'm currently using:
-------------------------------
tell application "Safari"
launch
open location targetURL
repeat until exists source of document 1
end repeat
set pageFullyLoaded to false
repeat until pageFullyLoaded
set pageSourceCompare1 to get source of document 1
delay 20
set pageSourceCompare2 to get source of document 1
if pageSourceCompare1 = pageSourceCompare2 then set
pageFullyLoaded to true
end repeat
...The code to parse the HTML follows...
-------------------------------
Is there a faster way to detect when the page has been fully
downloaded, or
better yet, a plug-in/suite/method that would allow me to skip
having to
wait for Safari to download and display the page.
Problem 2:
Some of the data will have to be looked up by submitting info to a
cgi form
on a website. How on earth do I go about that?
Monte Babington
Director of Production
If you want the text of the Safari window, why don't you get the text
of the Safari window?
<script>
tell application "Safari"
activate
set targetURL to "http://www.apple.com"
open location targetURL
repeat until exists window "Apple"
end repeat
get text of document 1
end tell
</script>
It will be probably easy to parse what you want.
Deivy _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden