1
0
Fork 0

Minor cleanup

This commit is contained in:
Andrew Tomaka 2024-12-10 19:47:10 -05:00
parent faff51b9d3
commit 57715c25ee
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -40,14 +40,14 @@ end
local = Dir
.entries(".")
.select { |entry| File.directory?(entry) && !entry.match?(/^\./) }
.select { File.directory?(_1) && !_1.match?(/^\./) }
browser.goto("https://adventofcode.com/")
cookies = JSON.parse(File.read("tmp/cookies.json"))
cookies.each { |cookie| browser.cookies.add(cookie["name"], cookie["value"], domain: cookie["domain"]) }
cookies.each { browser.cookies.add(_1["name"], _1["value"], domain: _1["domain"]) }
pre_element = browser.element(tag_name: "pre", class: "calendar")
doc = Nokogiri::HTML(pre_element.html)
links = doc.css("a").map { |link| link["href"] }
links = doc.css("a").map { _1["href"] }
available = links.map { _1.scan(/day\/(\d+)/) }.flatten.map { "%02d" % _1 }