This seems to NOT work with Firefox. Please use other browsers if you face any problems.
This tool let you download a cookies.json file from a cURL request to O'Reilly which allows you to authenticate and download books using the tool github.com/lorenzodifuccia/safaribooks.