September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
24
Task/Web-scraping/Phix/web-scraping.phix
Normal file
24
Task/Web-scraping/Phix/web-scraping.phix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
-- demo\rosetta\web_scrape.exw
|
||||
include builtins\libcurl.e
|
||||
include builtins\timedate.e
|
||||
|
||||
object res = curl_easy_perform_ex("https://tycho.usno.navy.mil/cgi-bin/timer.pl")
|
||||
if string(res) then
|
||||
res = split(res,'\n')
|
||||
for i=1 to length(res) do
|
||||
integer k = match("UTC",res[i])
|
||||
if k then
|
||||
res = res[i][5..k-2]
|
||||
exit
|
||||
end if
|
||||
end for
|
||||
?res
|
||||
if string(res) then
|
||||
timedate td = parse_date_string(res, {"Mmm. d, hh:mm:ss"})
|
||||
td[DT_YEAR] = date()[DT_YEAR]
|
||||
?format_timedate(td,"h:mpm Dddd ddth Mmmm")
|
||||
?format_timedate(date(),"h:mpm Dddd ddth Mmmm")
|
||||
end if
|
||||
else
|
||||
?{"some error",res,curl_easy_strerror(res)}
|
||||
end if
|
||||
|
|
@ -2,4 +2,4 @@
|
|||
(require net/url)
|
||||
((compose1 car (curry regexp-match #rx"[^ <>][^<>]+ UTC")
|
||||
port->string get-pure-port string->url)
|
||||
"http://tycho.usno.navy.mil/cgi-bin/timer.pl")
|
||||
"https://tycho.usno.navy.mil/cgi-bin/timer.pl")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue