# mip-push

> 使用nodejs推送MIP数据到百度站长平台

Latest version **0.1.2** (published 2017-10-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install mip-push
pnpm add mip-push
yarn add mip-push
bun add mip-push
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2017-10-30 |
| First published | 2017-04-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.0.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | xuexb |
| Maintainers | xuexb |
| Keywords | mip, mip-push |

## Links

- npm: https://www.npmjs.com/package/mip-push
- Repository: https://github.com/xuexb/mip-push
- Issues: https://github.com/xuexb/mip-push/issues
- npm.io page: https://npm.io/package/mip-push

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.81.0
- [babel-runtime](https://npm.io/package/babel-runtime.md) 6.x.x

## Recent versions

- 0.1.2 (latest) — 2017-10-30
- 0.1.1 — 2017-08-27
- 0.0.2 — 2017-04-22
- 0.0.1 — 2017-04-21

## README

# mip-push

> 使用nodejs推送MIP数据到百度站长平台

[![code style fecs](https://img.shields.io/badge/code%20style-fecs-brightgreen.svg)](https://github.com/ecomfe/fecs)
[![Build Status](https://travis-ci.org/xuexb/mip-push.svg?branch=master)](https://travis-ci.org/xuexb/mip-push)
[![Test Coverage](https://img.shields.io/coveralls/xuexb/mip-push/master.svg)](https://coveralls.io/r/xuexb/mip-push)
[![MIT license](https://img.shields.io/github/license/xuexb/mip-push.svg)](https://github.com/xuexb/mip-push)

## 安装

```shell
$ [sudo] npm i mip-push
```

## 使用

```js
var Mip = require('mip-push');
var app = new Mip({
    site: '',
    token: ''
});

// 推送数据，返回 Promise
app.push(url).then(function (res) {
    console.log(res);
}).catch(function (err) {
    console.error(err);
});
app.push([
    url1,
    url2,
    url3
]).then(function (res) {
    console.log(res);
}).catch(function (err) {
    console.error(err);
});
```

## 成功响应

> 参考 [百度站长平台](http://zhanzhang.baidu.com/mip/index)

```js
{
    // 当天剩余的可推送url条数
    remain: 4999998,

    // 成功推送的url条数
    success: 2,

    // 由于不是本站url而未处理的url列表
    not_same_site: [],

    // 不合法的url列表
    not_valid: []
}
```

## 响应错误码

#### 后端服务出错

```js
{
    error: -1,
    message: 具体错误信息 || 'server error'
}
```

#### 后端返回值错误

```js
{
    error: -2,
    message: 'parse json error'
}
```

#### 数据错误

> 参考 [百度站长平台](http://zhanzhang.baidu.com/mip/index)

```js
{
    // 错误码，与状态码相同
    error: 4xx,

    // 错误描述
    message: 'token is not valid'
}
```

## 更新日志

### 0.1.0

- 由于百度站长平台接口更新, 删除`delete, update`接口
- 优化代码和测试覆盖率
- 添加`nodejs4.x-nodejs8.x`测试

### 0.0.2

发布npm包

## todo

- [ ] cli命令

---
_Source: https://npm.io/package/mip-push · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
