Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shincurry/tokotohi
Hitokoto Node.js version
https://github.com/shincurry/tokotohi
hitokoto hitokoto-node
Last synced: about 2 months ago
JSON representation
Hitokoto Node.js version
- Host: GitHub
- URL: https://github.com/shincurry/tokotohi
- Owner: shincurry
- License: gpl-3.0
- Created: 2015-11-29T07:46:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-30T13:03:18.000Z (about 9 years ago)
- Last Synced: 2024-04-18T06:19:57.152Z (8 months ago)
- Topics: hitokoto, hitokoto-node
- Language: JavaScript
- Size: 17.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tokotohi
Hitokoto Node.js version[中文](#chinese)
## Usage
### Sync Call
```
```
### Async Call
```
setTimeout(function() {
var scr = document.createElement('script');
scr.setAttribute('src','/hitokoto?callback=setHitokoto');
document.body.appendChild(scr);
},100);
```### Callback
```
function setHitokoto(res) {
// do something...
}
```## Tokotohi Module Usage
1. copy `module` into your project folder
2. insert `var hitokoto = require('./modules/hitokoto');` into your code
3. `hitokoto.getData(function(data) { // do something... });`
4. Done.### block some keywords
```
setBlockedWords(array); // Array params
```## Data Object Schema Example
```
var data = {
id : "123456789",
content : "赠人玫瑰,手有余香;还人玫瑰,手有余伤。",
source : "ShinCurry"
}
```## Demo
[Windisco](https://windisco.com)
# Tokotohi 中文
Hitokoto Node.js version
[中文](#chinese)
## 调用方法
### 同步调用
```
```
### 异步调用
```
setTimeout(function() {
var scr = document.createElement('script');
scr.setAttribute('src','/hitokoto?callback=setHitokoto');
document.body.appendChild(scr);
},100);
```### 回调函数
```
function setHitokoto(res) {
// do something...
}
```## 模块的使用方法
1. 拷贝 `module` 文件夹到你自己的项目目录
2. 导入 Module `var hitokoto = require('./modules/hitokoto');`
3. 调用 `hitokoto.getData(function(data) { // do something... });`### 屏蔽某些关键词
```
setBlockedWords(array); // 传入一个数组
```## 获取数据的对象模型[舍去了部分无用数据]
```
var data = {
id : "123456789",
content : "赠人玫瑰,手有余香;还人玫瑰,手有余伤。",
source : "ShinCurry"
}
```