30 lines
779 B
Plaintext
30 lines
779 B
Plaintext
Module Web_scraping {
|
|
Print "Web scraping"
|
|
function GetTime$(a$, what$="UTC") {
|
|
document a$ ' change string to document
|
|
find a$, what$ ' place data to stack
|
|
Read find_pos
|
|
if find_pos>0 then
|
|
read par_order, par_pos
|
|
b$=paragraph$(a$, par_order)
|
|
k=instr(b$,">")
|
|
if k>0 then if k<par_pos then b$=mid$(b$,k+1) :par_pos-=k
|
|
k=rinstr(b$,"<")
|
|
if k>0 then if k>par_pos then b$=Left(b$,k-1)
|
|
=b$
|
|
end if
|
|
}
|
|
declare msxml2 "MSXML2.XMLHTTP.6.0"
|
|
rem print type$(msxml2)="IXMLHTTPRequest"
|
|
Url$ = "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
|
|
try ok {
|
|
method msxml2, "Open", "GET", url$, false
|
|
method msxml2,"Send"
|
|
with msxml2,"responseText" as txt$
|
|
Print GetTime$(txt$)
|
|
}
|
|
If error or not ok then Print Error$
|
|
declare msxml2 nothing
|
|
}
|
|
Web_scraping
|