WebPurify API for Node.js
This module allows simple interaction with the WebPurify API within Node.js. For more information about WebPurify and the services it offers, check out http://webpurify.com/.
Commands
Filters
Blacklist
Whitelist
Image Moderation
Install & Initialize
npm install webpurify
To initialize:
// ES6; // Otherwiseconst WebPurify = ; const wp = api_key: ENV'WEBPURIFY_API_KEY' //, endpoint: 'us' // Optional, available choices: 'eu', 'ap'. Default: 'us'. //, enterprise: false // Optional, set to true if you are using the enterprise API, allows SSL;
Commands
check
Check a string of text for profanity. Returns true if profanity found, false if none.
wp;
checkCount
Check a string of text for profanity. Returns number of words if profanity found, 0 if none.
wp;
replace
Check a string of text for profanity. Replaces any found profanity with a provided symbol, and returns the formatted string.
wp;
return
Check a string of text for profanity. If any found, returns an array of profane words. Else, returns empty array.
wp;
Options
All filter commands can take an additional options object, just before the callback. The available options are:
var optional = lang: 'en' // the 2 letter language code for the text you are submitting semail: 1 // treat email addresses like profanity sphone: 1 // treat phone numbers like profanity slink: 1 // treat urls like profanity; wp;
addToBlacklist
Add a word to the blacklist.
wp;
Can also be called without callback:
wp;
For Deep search, add optional parameter 1 after word:
wp;
removeFromBlacklist
Remove a word from the blacklist.
wp;
Can also be called without callback:
wp;
getBlacklist
Get the blacklist as an array of words.
wp;
addToWhitelist
Add a word to the whitelist.
wp;
Can also be called without callback:
wp;
removeFromWhitelist
Remove a word from the whitelist.
wp;
Can also be called without callback:
wp;
getWhitelist
Get the whitelist as an array of words.
wp;
Image Moderation
imgCheck
Use this method to submit an image to the moderation service. It will return an image ID that is used to return the results of the moderation to a callback function.
wp;
imgStatus
Returns the moderation status of an image. Possible results can be: pending, approved, declined.
wp;
imgAccount
Check the number of image submissions remaining on your license.
wp;
aimImgCheck
Use this method to submit an image to the WebPurify Automated Intelligent Moderation (AIM) Service. A percentage probability that the submitted image contains nudity will be returned in real-time.
wp;
aimImgAccount
Check the number of AIM image submissions remaining on your license.
wp;
hybridImgCheck
Combine our Automated Intelligent Moderation system (AIM) and our Live moderators to create a powerful low cost solution.
Images submitted to this method, are first sent to AIM and then sent to our live moderation team based on thresholds you set.
I.E any image that is given a 50% or greater probability by AIM can then be sent to our human moderation team for further review.
wp;