New fields

This commit is contained in:
JimZAH 2023-03-15 21:34:05 +00:00
parent 3f3eeeeabb
commit 6201a4919b

View File

@ -21,13 +21,15 @@ type Call struct {
Num string `json:"num"`
Date string `json:"date"`
Call string `json:"call"`
Id string `json:"id"`
Sec string `json:"sec"`
Slot string `json:"slot"`
Talkgroup string `json:"talkgroup"`
}
type Config struct {
Page string `json:"page"`
Reload int64 `json:"reload"`
Page string `json:"page"`
Reload int64 `json:"reload"`
}
func req(w http.ResponseWriter, r *http.Request) {
@ -53,7 +55,7 @@ func scrape(config *Config, callback chan []Call) {
c.OnHTML("table > tbody", func(h *colly.HTMLElement) {
h.ForEach("tr", func(_ int, el *colly.HTMLElement) {
if el.ChildText("td:nth-child(1)") != "" {
this_call := Call{Num: el.ChildText("td:nth-child(1)"), Date: el.ChildText("td:nth-child(3)"), Call: el.ChildText("td:nth-child(8)"), Slot: el.ChildText("td:nth-child(10)"), Talkgroup: el.ChildText("td:nth-child(11)")}
this_call := Call{Num: el.ChildText("td:nth-child(1)"), Date: el.ChildText("td:nth-child(3)"), Call: el.ChildText("td:nth-child(8)"), Id: el.ChildText("td:nth-child(7)"), Sec: el.ChildText("td:nth-child(4)"), Slot: el.ChildText("td:nth-child(10)"), Talkgroup: el.ChildText("td:nth-child(11)")}
new_calls = append(new_calls, this_call)
}
})