diff --git a/docs/other.md b/docs/other.md index ecaf870c8..2d959658c 100644 --- a/docs/other.md +++ b/docs/other.md @@ -469,3 +469,7 @@ type 为 all 时,category 参数不支持 cost 和 free ### 腾讯谷雨 + +### checkee.info + + diff --git a/lib/router.js b/lib/router.js index b76f5bc6e..0d4ac3b2a 100755 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/checkee/index.js b/lib/routes/checkee/index.js new file mode 100644 index 000000000..f9a952fc8 --- /dev/null +++ b/lib/routes/checkee/index.js @@ -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, + }; +};