Web scraping: Difference between revisions

Content added Content deleted
Line 982:
I'm using the <code>Requests.jl</code> package for this solution. Note, I used a slightly different URL after finding that the one specified in the task description is deprecated (though it still works).
<lang Julia>using Requests
 
function getusnotime()
const url = "http://tycho.usno.navy.mil/timer.pl"
Line 991:
end
isa(s, Requests.Response) || return (s, false)
t = match(r"(?<=<BR>)(.*?UTC)", readall(s))
isa(t, RegexMatch) || return (println@sprintf("raw html:\n %s", readall(s)), false)
return (t.match, true)
end
 
(t, issuccess) = getusnotime()
 
if issuccess
println("The USNO time is ", t)