Re: Extracting data from HTML
Re: Extracting data from HTML
- Subject: Re: Extracting data from HTML
- From: Irwin Poche <email@hidden>
- Date: Mon, 9 Feb 2004 22:13:18 -0600
>
On Feb 9, 2004, at 2:47 PM, Doug McNutt wrote:
>
>
At 13:37 -0600 2/9/04, Irwin Poche wrote:
>
> Quite sometime ago I scripted IE to load a page ever so often, pull
>
> some information from the page, and write out a summary of that
>
> information.
>
>
Take the time to learn curl and perl. Curl will download the page and
>
perl with its regular expression capability is great for extracting
>
repeated information. The whole thing can be scripted and run with
>
cron. A simple AppleScript can initiate the whole thing in Mac OS neXt
>
but it will also run on a $20 Linux box without modification.
>
>
Ask off line for some samples which are quite simple so long as you
>
don't get involved with https and certification of public keys.
>
>
--
>
>
Applescript syntax is like English spelling:
>
Roughly, but not thoroughly, thought through.
>
Thanks Doug - I was unaware of curl. Very handy. I am aware of Perl
and I'm learning it, slowly, so at this point I'll still use AS.
Unfortunately curl and Safari's View Source give me different results.
curl does not give me the information I'm looking for.
If you run this script and then paste the URL into Safari, I think
you'll see what I mean.
tell application "Finder"
set theURL to
"
http://www.mapquest.com/directions/main.adp?
1a=13701 Independence Parkway&1c=Fort Worth&1s=TX&src=maps&2s=TX&2
c=Dallas"
set curlCmd to "curl \"" & theURL & "\""
set thePage to (do shell script curlCmd) as text
display dialog (length of thePage)
set cityMarkStart to "<td valign=center align=left class=size12>"
set DistanceMarkStart to "Total Est. Distance:"
display dialog (offset of cityMarkStart in thePage) -- always zero
display dialog (offset of DistanceMarkStart in thePage) -- always zero
thePage
end tell
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.