WebPurify
WebPurify NPM Module A Node NPM module for interacting with the WebPurify API
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object): WebPurify |
Member Summary
Private Members | ||
private |
_config: * |
|
private |
_query_base: {"api_key": *, "format": string} |
|
private |
_request_base: {"host": *, "path": *} |
Method Summary
Public Methods | ||
public |
async addToBlacklist(word: string, ds: string): Promise Add a word to the blacklist |
|
public |
async addToWhitelist(word: string, ds: string): Promise Add a word to the whitelist |
|
public |
async aimImgAccount(): Promise Check the number of AIM image submissions remaining on your license. |
|
public |
async aimImgCheck(imgurl: string): Promise Checks the passed imageurl moderation. |
|
public |
Checks the passed text for any profanity. |
|
public |
async checkCount(text: string, options: Object): Promise Checks the passed text for any profanity. |
|
public |
Formats the request for the request function |
|
public |
async getBlacklist(ds: string): Promise Get the blacklist |
|
public |
async getWhitelist(ds: string): Promise Get the whitelist |
|
public |
async hybridImgCheck(imgurl: string, options: Object): Promise Combine our Automated Intelligent Moderation system (AIM) and our Live moderators to create a powerful low cost solution. |
|
public |
async imgAccount(): Promise Checks the remaining submissions on licence for images. |
|
public |
Checks the passed imageurl moderation. |
|
public |
Checks the imgid for status of moderation. |
|
public |
async removeFromBlacklist(word: string): Promise Remove a word from the blacklist |
|
public |
async removeFromWhitelist(word: string): Promise Remove a word from the whitelist |
|
public |
Checks the passed text for any profanity. |
|
public |
Handles the HTTP/S requests |
|
public |
Checks the passed text for any profanity. |
|
public |
Strips the WebPurify JSON response to be useful |
Public Constructors
public constructor(options: Object): WebPurify source
Params:
Name | Type | Attribute | Description |
options | Object | Pass configuration options here, or declare them in their respective ENV variables. |
|
options.api_key | Object | WebPurify API Key. ENV variable (takes precedence): WEBPURIFY_API_KEY |
|
options.endpoint | Object | Available: 'us', 'eu', 'ap'. Default: 'us'. ENV variable: WEBPURIFY_ENDPOINT |
|
options.enterprise | Object | Available: true, false. Default: false. ENV varable: WEBPURIFY_ENTERPRISE |
Public Methods
public async aimImgAccount(): Promise source
Check the number of AIM image submissions remaining on your license.
public async aimImgCheck(imgurl: string): Promise source
Checks the passed imageurl moderation. It will need a callback.
Params:
Name | Type | Attribute | Description |
imgurl | string | The URL of the image |
public async check(text: string, options: Object): Promise source
Checks the passed text for any profanity. If found, returns true, else false.
Params:
Name | Type | Attribute | Description |
text | string | The text to check for profanity |
|
options | Object |
|
The optional API parameters |
options.lang | Object |
|
The 2 letter language code for the text you are submitting |
options.semail | Object |
|
Treat email addresses like profanity. set = 1 |
options.sphone | Object |
|
Treat phone numbers like profanity. set = 1 |
options.slink | Object |
|
Treat urls like profanity. set = 1 |
options.rsp | Object |
|
To include our response time in the result. set = 1 |
public async checkCount(text: string, options: Object): Promise source
Checks the passed text for any profanity. If found, returns number of found words, else 0.
Params:
Name | Type | Attribute | Description |
text | string | The text to check for profanity |
|
options | Object |
|
The optional API parameters |
options.lang | Object |
|
The 2 letter language code for the text you are submitting |
options.semail | Object |
|
Treat email addresses like profanity. set = 1 |
options.sphone | Object |
|
Treat phone numbers like profanity. set = 1 |
options.slink | Object |
|
Treat urls like profanity. set = 1 |
options.rsp | Object |
|
To include our response time in the result. set = 1 |
public async get(params: Object, options: Object, host: Object): Promise source
Formats the request for the request function
public async getBlacklist(ds: string): Promise source
Get the blacklist
Params:
Name | Type | Attribute | Description |
ds | string |
|
Set equal to 1 to show which of the blacklist items have “deep search” turned on. |
public async getWhitelist(ds: string): Promise source
Get the whitelist
Params:
Name | Type | Attribute | Description |
ds | string |
|
Set equal to 1 to show which of the blacklist items have “deep search” turned on. |
public async hybridImgCheck(imgurl: string, options: Object): Promise source
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.
Params:
Name | Type | Attribute | Description |
imgurl | string | The URL of the image |
|
options | Object |
|
The optional API parameters |
options.thresholdlt | Object |
|
Set the lower threshold to pass the image to our live team. E.g. thresholdlt=50 would send all images that AIM gives a nudity probability of less than 50 to our live team. |
options.thresholdgt | Object |
|
Set the upper threshold to pass the image to our live team. E.g. thresholdgt=70 would send all images that AIM gives a nudity probability of greater than 70 to our live team. |
options.customimgid | Object |
|
A custom ID you wish to associate with the image that will be carried through to the callback |
options.callback | Object |
|
You may also submit a URL encoded callback on a per image basis |
public async imgCheck(imgurl: string, options: Object): Promise source
Checks the passed imageurl moderation. It will need a callback.
Params:
Name | Type | Attribute | Description |
imgurl | string | Full url to the image you would like moderated. |
|
options | Object |
|
The optional API parameters |
options.customimgid | Object |
|
A custom ID you wish to associate with the image that will be carried through to the callback |
options.callback | Object |
|
You may also submit a URL encoded callback on a per image basis |
options.snstopic | Object |
|
SNS Topic name. To use AWS SNS to receive results |
options.photodna | object |
|
Set = 1 to check images for matches against known child exploitation hash datasets – You must activate PhotoDNA for your API Key in your admin console. |
public async imgStatus(imgid: string, options: Object): Promise source
Checks the imgid for status of moderation.
public async removeFromBlacklist(word: string): Promise source
Remove a word from the blacklist
Params:
Name | Type | Attribute | Description |
word | string | The word to remove from the blacklist |
public async removeFromWhitelist(word: string): Promise source
Remove a word from the whitelist
Params:
Name | Type | Attribute | Description |
word | string | The word to remove from the whitelist |
public async replace(text: string, replacesymbol: string, options: Object): Promise source
Checks the passed text for any profanity. If found, returns the text with profanity altered by symbol. Else 0.
Params:
Name | Type | Attribute | Description |
text | string | The text to check for profanity |
|
replacesymbol | string | The symbol to replace profanity with (ie. '*') |
|
options | Object |
|
The optional API parameters |
options.lang | Object |
|
The 2 letter language code for the text you are submitting |
options.semail | Object |
|
Treat email addresses like profanity. set = 1 |
options.sphone | Object |
|
Treat phone numbers like profanity. set = 1 |
options.slink | Object |
|
Treat urls like profanity. set = 1 |
options.rsp | Object |
|
To include our response time in the result. set = 1 |
public request(host: string, path: string, method: string, ssl: boolean): Promise source
Handles the HTTP/S requests
Params:
Name | Type | Attribute | Description |
host | string | The hostname for the request URL (ie. api1.webpurify.com) |
|
path | string | The path of the request (ie. /services/rest/) |
|
method | string | The method, either 'GET or 'PUT' |
|
ssl | boolean | True or false for using HTTPS or HTTP. If you are using enterprise API, you can set this to true. |
public async return(text: string, options: Object): Promise source
Checks the passed text for any profanity. If found, returns an array of expletives.
Params:
Name | Type | Attribute | Description |
text | string | The text to check for profanity |
|
options | Object |
|
The optional API parameters |
options.lang | Object |
|
The 2 letter language code for the text you are submitting |
options.semail | Object |
|
Treat email addresses like profanity. set = 1 |
options.sphone | Object |
|
Treat phone numbers like profanity. set = 1 |
options.slink | Object |
|
Treat urls like profanity. set = 1 |
options.rsp | Object |
|
To include our response time in the result. set = 1 |