Web scraping: Difference between revisions

Content added Content deleted
Line 992: Line 992:
end
end
isa(s, Requests.Response) || return (s, false)
isa(s, Requests.Response) || return (s, false)
t = match(r"<BR>(.*UTC)", readall(s))
t = match(r"(?<=<BR>).*?(?=UTC)", readall(s))
isa(t, RegexMatch) || return (@sprintf("raw html:\n %s", readall(s)), false)
isa(t, RegexMatch) || return (@sprintf("raw html:\n %s", readall(s)), false)
return (t.match[5:end, true)
return (t.match[5:end, true)
Line 1,000: Line 1,000:


if issuccess
if issuccess
println("The USNO time is ", t)
println("The USNO time is ", t, " UTC")
else
else
println("Failed to fetch UNSO time:\n", t)
println("Failed to fetch UNSO time:\n", t)