From 57715c25eeba7b4791661c4c3336ff3de9cab083 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 10 Dec 2024 19:47:10 -0500 Subject: [PATCH] Minor cleanup --- download-problems | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/download-problems b/download-problems index 8fbd82d..8cfcb41 100755 --- a/download-problems +++ b/download-problems @@ -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 }