It is not so much an issue for me now, but relentless masturbation and hookers chewed up a lot of my time when I was hyper sexually manic from bipolar. I remember that even when I had a partner happy to have sex every day I was still jerking off every few hours sometimes. Turns out it was exacerbated by dexamfetamine. In retrospect I should have channeled it into something like sport because it escalated. Fapping often turned to getting rub’n’tug massages, which turned to paying extra for blowjos, which eventually turned to visiting regular brothels.
I think the excitement and pleasure of it keyed into my addictive personality and I continued even when other symptoms of my mania had subsided. It was extremely difficult to stop and I had to treat it like a drug addiction.
It can definitely be brought on and exacerbated by different meds, but when I switched to an anti- Psychotic rather than an SSRI it did lessen considerably. But I think the changes you need to be made are cognitive and behavioural rather than chemical.