Update data structure
This commit is contained in:
parent
e4b21fc080
commit
1b2a337b79
65
getaoc.go
65
getaoc.go
|
@ -17,13 +17,13 @@ func GetInput(session string, year, day int) (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
r.AddCookie(&http.Cookie{
|
r.AddCookie(&http.Cookie{
|
||||||
Name: "session",
|
Name: "session",
|
||||||
Value: session,
|
Value: session,
|
||||||
Path: "",
|
Path: "",
|
||||||
Domain: ".adventofcode.com",
|
Domain: ".adventofcode.com",
|
||||||
Secure: false,
|
Secure: false,
|
||||||
HttpOnly: false,
|
HttpOnly: false,
|
||||||
SameSite: 0,
|
SameSite: 0,
|
||||||
})
|
})
|
||||||
c := http.Client{}
|
c := http.Client{}
|
||||||
resp, err := c.Do(r)
|
resp, err := c.Do(r)
|
||||||
|
@ -44,13 +44,13 @@ func GetLeaderboard(session string, year, id int) (LeaderBoard, error) {
|
||||||
return board, err
|
return board, err
|
||||||
}
|
}
|
||||||
r.AddCookie(&http.Cookie{
|
r.AddCookie(&http.Cookie{
|
||||||
Name: "session",
|
Name: "session",
|
||||||
Value: session,
|
Value: session,
|
||||||
Path: "",
|
Path: "",
|
||||||
Domain: ".adventofcode.com",
|
Domain: ".adventofcode.com",
|
||||||
Secure: false,
|
Secure: false,
|
||||||
HttpOnly: false,
|
HttpOnly: false,
|
||||||
SameSite: 0,
|
SameSite: 0,
|
||||||
})
|
})
|
||||||
c := http.Client{}
|
c := http.Client{}
|
||||||
resp, err := c.Do(r)
|
resp, err := c.Do(r)
|
||||||
|
@ -67,15 +67,38 @@ func GetLeaderboard(session string, year, id int) (LeaderBoard, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Member struct {
|
type Member struct {
|
||||||
ID string `json:"id"`
|
GlobalScore int `json:"global_score"`
|
||||||
Stars int `json:"stars"`
|
Stars int `json:"stars"`
|
||||||
GlobalScore int `json:"global_score"`
|
LocalScore int `json:"local_score"`
|
||||||
Name string `json:"name"`
|
LastStarTs int `json:"last_star_ts"`
|
||||||
LocalScore int `json:"local_score"`
|
ID int `json:"id"`
|
||||||
|
CompletionDayLevel struct {
|
||||||
|
Num1 struct {
|
||||||
|
Num1 struct {
|
||||||
|
GetStarTs int `json:"get_star_ts"`
|
||||||
|
StarIndex int `json:"star_index"`
|
||||||
|
} `json:"1"`
|
||||||
|
Num2 struct {
|
||||||
|
GetStarTs int `json:"get_star_ts"`
|
||||||
|
StarIndex int `json:"star_index"`
|
||||||
|
} `json:"2"`
|
||||||
|
} `json:"1"`
|
||||||
|
Num2 struct {
|
||||||
|
Num1 struct {
|
||||||
|
GetStarTs int `json:"get_star_ts"`
|
||||||
|
StarIndex int `json:"star_index"`
|
||||||
|
} `json:"1"`
|
||||||
|
Num2 struct {
|
||||||
|
GetStarTs int `json:"get_star_ts"`
|
||||||
|
StarIndex int `json:"star_index"`
|
||||||
|
} `json:"2"`
|
||||||
|
} `json:"2"`
|
||||||
|
} `json:"completion_day_level"`
|
||||||
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LeaderBoard struct {
|
type LeaderBoard struct {
|
||||||
Event string `json:"event"`
|
Event string `json:"event"`
|
||||||
OwnerID string `json:"owner_id"`
|
OwnerID int `json:"owner_id"`
|
||||||
Members map[string]Member `json:"members"`
|
Members map[string]Member `json:"members"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue