using HTTP, CSV, DataFrames
function doanalysis()
dfg=nothing
for x in 21200
print("\r peeking at GCN $x ")
try
url = "https://gcn.nasa.gov/circulars/$x/raw"
resp = HTTP.get(url)
status=resp.status
print(" ",status," ");
if status == 404 ; println("status=",status); continue; end
txt = String(resp.body)
if occursin(r"GRB ?\d{6}([A-G]|(\.\d{2}))?",txt)
m=match(r"GRB ?\d{6}([A-G]|(\.\d{2}))?",txt)
print(m.match)
end
if occursin("GROND observations", txt)
println(" GROND report")
he=first(findfirst(r"^(g'|r'|i'|z'|J|H|K)"m,txt))
lr=first(findnext(r"^(?:[\t ]*(?:\r?\n|\r))+"m,txt,he))
cltxt=replace(txt[he:lr], r" ?(=|>)"=>"|" , "+/-"=>"|")
df=CSV.read(IOBuffer(cltxt), DataFrame, delim="|" ,header=0)
df.GCN=[x for i in 1:nrow(df)]
df.GRB=[m.match for i in 1:nrow(df)]
if isnothing(dfg)
@show dfg=df
else
@show dfg=vcat(dfg,df)
end # if x is first
end # if occursin
catch e
println("error ")
end # trycatch
end # for loop
end
doanalysis()
give output shown below GCN 21200