scouting: Call ranking scraper
Signed-off-by: Yash Chainani <yashchainani28@gmail.com>
Change-Id: Ife105e949783587c4fb5f74eb77d4c14a1aabe22
diff --git a/scouting/scraping/scrape.go b/scouting/scraping/scrape.go
index 19426cf..625157a 100644
--- a/scouting/scraping/scrape.go
+++ b/scouting/scraping/scrape.go
@@ -13,8 +13,10 @@
// Stores the TBA API key to access the API.
type scrapingConfig struct {
- ApiKey string `json:"api_key"`
- BaseUrl string `json:"base_url"`
+ ApiKey string `json:"api_key"`
+ BaseUrl string `json:"base_url"`
+ Year int32 `json:"year"`
+ EventCode string `json:"event_code"`
}
// Takes in year and FIRST event code and returns requested information according to TBA.
@@ -47,9 +49,15 @@
if config.BaseUrl == "" {
config.BaseUrl = "https://www.thebluealliance.com"
}
+ if config.Year == 0 {
+ config.Year = year
+ }
+ if config.EventCode == "" {
+ config.EventCode = eventCode
+ }
// Create the TBA event key for the year and event code.
- eventKey := strconv.Itoa(int(year)) + eventCode
+ eventKey := strconv.Itoa(int(config.Year)) + config.EventCode
// Create a get request for the match info.
req, err := http.NewRequest("GET", config.BaseUrl+"/api/v3/event/"+eventKey+"/"+category, nil)