add route checkee.info (#1850)
This commit is contained in:
parent
24f7ea281b
commit
e02b58c113
|
|
@ -469,3 +469,7 @@ type 为 all 时,category 参数不支持 cost 和 free
|
|||
### 腾讯谷雨
|
||||
|
||||
<Route name="栏目" author="LogicJake" example="/tencent/guyu/channel/lab" path="/tencent/guyu/channel/:name" :paramsDesc="['栏目名称,包括lab,report,story,shalong']"/>
|
||||
|
||||
### checkee.info
|
||||
|
||||
<Route name="美国签证 check 动态" author="lalxyy" example="/checkee/2019-03" path="/checkee/:month" :paramsDesc="['签证被 check 的年份-月份,如 2019-03']" />
|
||||
|
|
|
|||
|
|
@ -1215,6 +1215,9 @@ router.get('/zju/career/:type', require('./routes/universities/zju/career'));
|
|||
router.get('/infoq/recommend', require('./routes/infoq/recommend'));
|
||||
router.get('/infoq/topic/:id', require('./routes/infoq/topic'));
|
||||
|
||||
// checkee
|
||||
router.get('/checkee/:dispdate', require('./routes/checkee/index'));
|
||||
|
||||
// 艾瑞
|
||||
router.get('/iresearch/report', require('./routes/iresearch/report'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
const date = require('../../utils/date');
|
||||
|
||||
const host = 'https://www.checkee.info';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const dispdate = ctx.params.dispdate;
|
||||
|
||||
const link = `https://www.checkee.info/main.php?dispdate=${dispdate}`;
|
||||
const response = await axios.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $(':nth-child(11) tbody tr')
|
||||
.map(function() {
|
||||
return {
|
||||
id: $(this)
|
||||
.find(':nth-child(2)')
|
||||
.text(),
|
||||
visaType: $(this)
|
||||
.find(':nth-child(3)')
|
||||
.text(),
|
||||
visaEntry: $(this)
|
||||
.find(':nth-child(4)')
|
||||
.text(),
|
||||
usConsulate: $(this)
|
||||
.find(':nth-child(5)')
|
||||
.text(),
|
||||
major: $(this)
|
||||
.find(':nth-child(6)')
|
||||
.text(),
|
||||
status: $(this)
|
||||
.find(':nth-child(7)')
|
||||
.text(),
|
||||
checkDate: $(this)
|
||||
.find(':nth-child(8)')
|
||||
.text(),
|
||||
completeDate:
|
||||
$(this)
|
||||
.find(':nth-child(9)')
|
||||
.text() === '0000-00-00'
|
||||
? 'Not Completed'
|
||||
: $(this)
|
||||
.find(':nth-child(9)')
|
||||
.text(),
|
||||
link: $(this)
|
||||
.find(':nth-child(11) a')
|
||||
.attr('href'),
|
||||
note:
|
||||
$(this)
|
||||
.find(':nth-child(11) a')
|
||||
.attr('title') || '',
|
||||
};
|
||||
})
|
||||
.get();
|
||||
list.shift();
|
||||
|
||||
const out = list.map((item) => {
|
||||
const title =
|
||||
`${item.visaType} ${item.visaEntry}, ${item.usConsulate}, ` +
|
||||
`Major ${item.major}, ${item.status}. Check date: ${item.checkDate}` +
|
||||
(item.completeDate === 'Not Completed' ? '' : `, Complete: ${item.completeDate}`) +
|
||||
` | ID: ${item.id}`;
|
||||
const itemUrl = url.resolve(host, item.link);
|
||||
const date_value = item.checkDate;
|
||||
const description = item.note === '' ? title : item.note;
|
||||
|
||||
return {
|
||||
title: title,
|
||||
link: itemUrl,
|
||||
description: description,
|
||||
pubDate: date(date_value, 8),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `Check Reporter Results: ${dispdate}`,
|
||||
link: link,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue