Just started Advent Of Code 2020. For the first time I’m using Scriptable to solve the problems. I’m trying to down load the input for the fist problem but get this message in my console. “ Puzzle inputs differ by user. Please log in to get your puzzle input.” I have signed in on the website using my Twitter account. But don’t know how to do that from Scriptable. This is what I have so far.
let url = "https://adventofcode.com/2020/day/1/input"
let req = new Request(url)
let input = await req.loadString()
If I understand correctly, the adventofcode site uses OAUth to authenticate you for login, and unless they publish an API, you won’t easily get the puzzle via an automated http request. Coding that might be harder than the puzzle itself!
I believe you’re best off going to the login page, authenticating yourself via an existing account at google, Twitter, Reddit, etc as they direct, and then you can proceed.
Thanks for the reminder about adventofcode. I copied the numeric dataset for puzzle 1 into drafts so I can puzzle on it later today…
Thanks. Your solutions are teaching me so much. I want to get more concise in my coding. For today’s day 2 puzzle for instance, I parsed the input much like you, but brute-forced the rest with lots of for loops and character testing. Your answer reminded me how much further I could get with arrow notation and the .filter and .map array methods.
Yep. My code was a mess and my answer came up twice in the console(Must be a glitch in my 3 nested for loops.) But I love the thrill when I get the correct answer message. It actually encourages me that I’m starting to figure the mysterious art of coding a little bit.