Prepare for 2025.

This commit is contained in:
Chris Hodges 2025-11-28 10:50:07 +01:00
parent d49d3614c7
commit 79360efdf4
2 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,7 @@ repositories {
dependencies {
implementation("com.github.kittinunf.fuel:fuel:3.0.0-alpha1")
implementation("com.mohamedrejeb.ksoup:ksoup-html:0.4.0")
implementation("com.mohamedrejeb.ksoup:ksoup-html:0.6.0")
}
tasks {

View File

@ -23,7 +23,7 @@ fun main() {
cookie = props.getProperty("cookie", cookie)
}
val downloader = Downloader(2024, "aoc2024", cookie)
val downloader = Downloader(2025, "aoc2025", cookie)
downloader.updateToLatest()
}
@ -43,14 +43,15 @@ class Downloader(val year: Int, val packageName: String, val sessionCookie: Stri
Files.createDirectories(targetDir)
}
val now = LocalDate.now(ZoneId.of("UTC-1"))
val lastDay = if (now.isBefore(LocalDate.of(year, Month.DECEMBER, 25))) {
val maxPuzzles = if (year < 2025) 25 else 12
val lastDay = if (now.isBefore(LocalDate.of(year, Month.DECEMBER, maxPuzzles))) {
if (now.isAfter(LocalDate.of(year, Month.NOVEMBER, 30))) {
now.dayOfMonth
} else {
throw IllegalStateException("You're too early.")
}
} else {
25
maxPuzzles
}
for (day in 1..lastDay) {