项目作者: oozcitak

项目描述 :
Akismet API client for node.js
高级语言: TypeScript
项目地址: git://github.com/oozcitak/akismet-js.git
创建时间: 2010-11-29T21:29:34Z
项目社区:https://github.com/oozcitak/akismet-js

开源协议:MIT License

下载


An Akismet API client for node.js.

NPM version
License

Travis Build Status
AppVeyor Build status
Dev Dependency Status
Code Coverage

Installation:

  1. npm install --save akismet

Usage:

You need to sign up for an Akismet API key to use the API. Once you sign up,
it would be a good idea to verify your key.

  1. var akismet = require('akismet').client({ blog: 'http://my.blog.com', apiKey: 'myakismetapikey123' });
  2. akismet.verifyKey(function(err, verified) {
  3. if (verified)
  4. console.log('API key successfully verified.');
  5. else
  6. console.log('Unable to verify API key.');
  7. });

You can now use Akismet to moderate your comments.

  1. akismet.checkComment({
  2. user_ip: '1.1.1.1',
  3. permalink: 'http://www.my.blog.com/my-post',
  4. comment_author: 'spammer',
  5. comment_content: 'spamming your comments'
  6. }, function(err, spam) {
  7. if(spam)
  8. console.log('Spam caught.');
  9. else
  10. console.log('Not spam');
  11. });

You can also send feedback to Akismet with submitSpam and submitHam. Their usage is the same as checkComment.

  1. akismet.submitSpam({
  2. user_ip: '1.1.1.1',
  3. permalink: 'http://www.my.blog.com/my-post',
  4. comment_author: 'spammer',
  5. comment_content: 'that was spam but you failed to catch me'
  6. }, function(err) {
  7. console.log('Spam reported to Akismet.');
  8. });

See the wiki and Akismet API documentation for more information.