mirror of
https://github.com/Threnklyn/advent-of-code-go.git
synced 2026-06-13 15:13:31 +02:00
added scripts and 2020 folder
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/alexchao26/advent-of-code-go/scripts/fetchers"
|
||||
"github.com/alexchao26/advent-of-code-go/util"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// determine day to fetch
|
||||
day, year, cookie := fetchers.ParseFlags()
|
||||
fmt.Println("fetching for day", day)
|
||||
|
||||
// make the request
|
||||
url := fmt.Sprintf("https://adventofcode.com/%d/day/%d/input", year, day)
|
||||
body := fetchers.GetWithAOCCookie(url, cookie)
|
||||
|
||||
// write to file
|
||||
filename := filepath.Join(util.Dirname(), "../../..", fmt.Sprintf("%d/day%02d-input.txt", year, day))
|
||||
fetchers.WriteToFile(filename, body)
|
||||
|
||||
fmt.Println("Wrote to file: ", filename)
|
||||
|
||||
fmt.Println("Done!")
|
||||
}
|
||||
Reference in New Issue
Block a user