Re: http site text-only read possible?
- From: "e p chandler" <epc8@xxxxxxxx>
- Date: 6 Jun 2005 10:36:11 -0700
David Frank wrote:
> "Dr Ivan D. Reid" <Ivan.Reid@xxxxxxxxxxxx> wrote in message
> news:slrnda8rnr.27s.Ivan.Reid@xxxxxxxxxxxxxxxxxxxx
>
> > If you switch off image display then the image files aren't fetched
> > until you request them -- at least that's how it used to work when I was
> > on
> > slow connexions.
> >
>
> Here is a typical link that I try to decode in my RT_VIEW program.
>
> http://www.finance.lycos.com/qc/stocks/quotes.aspx?symbols=INDEX:SPX.X
>
>
> Read of this web page fills my RT_VIEW program's net read buffer with about
> 16kb of superfluous html that I then must parse to get my price data.
from the link supplied in a previous posting obtain wget.exe
set up a scheduled task which runs a .bat file containing
wget -O foo.txt url_goes_here
awk -f foo.awk foo.txt | awk -f foo1.awk >foo1.txt
my_fortran_program.exe .....
Notes:
The -O switch sends the downloaded file to the file "foo.txt"
foo.awk and foo1.awk are AWK scripts
The pattern in foo.awk matches all lines from a line containing the
first pattern to a line containing the second pattern. This is the HTML
table containing the data of interest.
foo1.awk grabs lines containing table data, removes extra stuff and
then concatenates the 8 numeric values into a single line of blank
separated data.
Finally a Fortran program reads and does something with the data
file....
foo.awk:
/<table summary=/,/<\/table>/
foo1.awk:
# grab <td>.....</td>
/<td>.*<\/td>$/ {
gsub(/ - /," ") # strip -
gsub(/,/,"") # strip ,
gsub(/ to /," ") # strip to
gsub(/\//,"") # strip /
gsub(/<td>/,"") # strip <td>
for(i=1;i<=NF;i++) b=b " " $i # append next number
# print # for debug
}
END{print b} # dump the vector
The OP or NG regulars are welcome to replace the AWK scripts with
Fortran programs, etc. if they so choose :-)!
A sample foo1.txt:
1192.75 1197.43 1196.02 1196.02 667 1375 1060.72 1229.11
Disclaimer: I take _no_ responsibility if the OP gets into trouble for
repeatedly and frequently wgetting this web page. :-).
.
- References:
- http site text-only read possible?
- From: David Frank
- Re: http site text-only read possible?
- From: Dr Ivan D. Reid
- Re: http site text-only read possible?
- From: David Frank
- http site text-only read possible?
- Prev by Date: Re: Fortran functions
- Next by Date: Re: wanted fast routines
- Previous by thread: Re: http site text-only read possible?
- Next by thread: Re: http site text-only read possible?
- Index(es):
Relevant Pages
|
|