High voltage capacitor discharger circuit

Hello, i got my Atlas ESR Plus (ESR70) - Capacitor Analyser. So even when it has integrated voltage discharge that’s for low voltages.

So I decided to make one using arduino nano, some lcd with bargraph etc.

How do I measure voltage up to 1000V safely using arduino, while the 470Ohm 5W resistor
as recommemded here:

discharges capacitor being probed ? I need to use opto coupler. But what and how to use?

The probes must have no polarity too.

I found this opto coupler vishay-h11aa1

It suppose to work for DC and AC voltage. Just what I need.

The recommended connection diagram was:

And whole article is at: https://electronics.stackexchange.com/questions/103297/measure-on-off-pulse-of-relay-with-reversed-polarity-with-a-mcu

Then there is this recommendation about protection up to 2.5kV using a bunch of resistors.

However is my simulation this does not work. And it’s not for reversed polarity or AC either. Any help appreciated