New fields
This commit is contained in:
parent
3f3eeeeabb
commit
6201a4919b
8
main.go
8
main.go
@ -21,13 +21,15 @@ type Call struct {
|
|||||||
Num string `json:"num"`
|
Num string `json:"num"`
|
||||||
Date string `json:"date"`
|
Date string `json:"date"`
|
||||||
Call string `json:"call"`
|
Call string `json:"call"`
|
||||||
|
Id string `json:"id"`
|
||||||
|
Sec string `json:"sec"`
|
||||||
Slot string `json:"slot"`
|
Slot string `json:"slot"`
|
||||||
Talkgroup string `json:"talkgroup"`
|
Talkgroup string `json:"talkgroup"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Page string `json:"page"`
|
Page string `json:"page"`
|
||||||
Reload int64 `json:"reload"`
|
Reload int64 `json:"reload"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func req(w http.ResponseWriter, r *http.Request) {
|
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) {
|
c.OnHTML("table > tbody", func(h *colly.HTMLElement) {
|
||||||
h.ForEach("tr", func(_ int, el *colly.HTMLElement) {
|
h.ForEach("tr", func(_ int, el *colly.HTMLElement) {
|
||||||
if el.ChildText("td:nth-child(1)") != "" {
|
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)
|
new_calls = append(new_calls, this_call)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user