Task

Create a program that downloads the time from this URL:   http://tycho.usno.navy.mil/cgi-bin/timer.pl   and then prints the current UTC time by extracting just the UTC time from the web page's HTML. Alternatively, if the above url is not working, grab the first date/time off this page's talk page.



If possible, only use libraries that come at no extra monetary cost with the programming language and that are widely available and popular such as CPAN for Perl or Boost for C++.




--
-- demo\rosetta\web_scrape.exw
-- ===========================
--
without js -- (libcurl)
include builtins\libcurl.e
include builtins\timedate.e

object res = curl_easy_perform_ex("https://rosettacode.org/wiki/Talk:Web_scraping")
if string(res) then
    res = split(res,'\n')
    for i=1 to length(res) do
        integer k = match("UTC",res[i])
        if k then
            string line = res[i] -- (debug aid)
            res = line[1..k-3]
            k = rmatch("</a>",res)
            res = trim(res[k+5..$])
            exit
        end if
    end for
    ?res
    if string(res) then
        timedate td = parse_date_string(res, {"hh:mm, d Mmmm yyyy"})
        ?format_timedate(td,"Dddd Mmmm ddth yyyy h:mpm")
    end if
else
    ?{"some error",res,curl_easy_strerror(res)}
end if
