Dump dom of url from command line with safari?
I’m fairly confident Safari isn’t amenable to scraping, so use Chrome or Firefox for that on macOS if you need a browser to be scriptable.
However, swift and python are exceptionally good at this by calling code directly via NSURL or equivalent as well as using the NSURLSessiond daemon and working with the OS directly and not even needing Safari.
- https://stackoverflow.com/questions/41517065/web-scraping-in-apple-swift-3
- How to know what nsurlsessiond is downloading
Of course you have to learn some new language and API/SDK for this to pay off. The pay off can be huge if you have a command line tool that does all the heavy lifting far more efficiently than Chrome or Safari can.