I don't think there is ready made solution for this. This is classification problem and you will need a trained model. You will need good sample data when it comes to model training.
There are demos:
https://nudenet.notai.tech/
https://nsfwjs.com/
Not sure if these classification results good for you.