Files
RSSHub/routes/express/express.js
T
さくら 49de384d2e feat: add prettier and commit hooks (#144)
* feat: add prettier and commit hooks

* style(*): prettier format

* fix(eslint): parsing error: Unexpected token ...

* style(eslint): eslint --fix

* style(bilibili): fix `no-undef` and `no-unused-vars`

* style(jiandan): fix eqeqeq

* style(pixiv): disable `no-constant-condition` rule for eslint

* fix(pixiv): use template string

* style(toutiao): remove unused variables

* style(weibo): use `forEach` instead of `map`

The array has no return value, you should use `forEach` instead of `map`

* chore(hooks): add eslint hooks

* chore(hooks): switch from husky to yorkie

* style(zhihu): prettier format

* style(docs): fix vuepress custom container

https://vuepress.vuejs.org/guide/markdown.html#custom-containers

* chore(prettier): set a more reasonable `printWidth` value

* style(*): better prettier format
2018-05-17 10:52:29 +08:00

31 lines
886 B
JavaScript

const axios = require('axios');
const config = require('../../config');
module.exports = async (ctx) => {
const company = ctx.params.company;
const number = ctx.params.number;
const response = await axios({
method: 'get',
url: `https://www.kuaidi100.com/query?type=${company}&postid=${number}`,
headers: {
'User-Agent': config.ua,
Referer: 'https://www.kuaidi100.com',
},
});
const data = response.data.data;
ctx.state.data = {
title: `快递 ${company}-${number}`,
link: 'https://www.kuaidi100.com',
description: `快递 ${company}-${number}`,
item: data.map((item) => ({
title: item.context,
description: item.context,
pubDate: new Date(item.time || item.ftime).toUTCString(),
link: item.context,
})),
};
};