# Scrap table from NASA GCN circulars website

**URL:** <https://discourse.julialang.org/t/scrap-table-from-nasa-gcn-circulars-website/101690>\
**Category:** Web Stack\
**Tags:** question, strings, csv, http\
**Created:** [July 17, 2023, 11:30am UTC](https://discourse.julialang.org/t/scrap-table-from-nasa-gcn-circulars-website/101690 "2023-07-17T11:30:13Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [July 28, 2023, 4:38pm UTC](https://discourse.julialang.org/t/scrap-table-from-nasa-gcn-circulars-website/101690/12 "2023-07-28T16:38:28Z")

</div>

```julia
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  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/4/a4de364afb0b4ce4933e20b78b951c3011083bf3.png)

---

_[View the full topic](https://discourse.julialang.org/t/scrap-table-from-nasa-gcn-circulars-website/101690)._
