feat: add checkra1n (#4289)

This commit is contained in:
ntzyz
2020-03-24 10:42:08 +08:00
committed by GitHub
parent ef27e7ca8b
commit 4a70e8ba76
3 changed files with 44 additions and 0 deletions

View File

@@ -50,6 +50,12 @@ pageClass: routes
<Route author="hoilc" example="/centbrowser/history" path="/centbrowser/history"/>
## Checkra1n
### 新版本发布
<Route author="ntzyz" example="/checkra1n/releases" path="/checkra1n/releases"/>
## Chocolatey
### 软件更新

View File

@@ -2409,6 +2409,9 @@ router.get('/hubu/news/:type', require('./routes/universities/hubu/news'));
// 大连海事大学
router.get('/dlmu/news/:type', require('./routes/universities/dlmu/news'));
// Checkra1n
router.get('/checkra1n/releases', require('./routes/checkra1n/releases'));
// 四川省科学技术厅
router.get('/sckjt/news/:type?', require('./routes/sckjt/news'));

View File

@@ -0,0 +1,35 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const homepage = 'https://checkra.in/releases/';
const response = await got({
method: 'get',
url: homepage,
});
const $ = cheerio.load(response.data);
const releases = $('.release');
ctx.state.data = {
title: `Checkra1n All Releases`,
link: homepage,
item: releases
.map((i, item) => {
const $item = $(item);
const address = 'https://checkra.in' + $item.find('a').attr('href');
return {
title: $item
.find('h3')
.first()
.text(),
description: $item.find('.changelog').html(),
link: address,
guid: address,
};
})
.get(),
};
};