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 }