This is some cool hacker stuff, but I imagine it’s against the terms of service

You mean using a headless browser to interact with a website designed for humans? Why would that be against their terms of service ;)