mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add grand-challenge (#6082)
This commit is contained in:
@@ -97,6 +97,16 @@ pageClass: routes
|
||||
|
||||
<Route author="ntzyz" example="/dhl/12345678" path="/dhl/:shipment_id" :paramsDesc="['运单号']"/>
|
||||
|
||||
## Grand-Challenge
|
||||
|
||||
### Challenge 列表
|
||||
|
||||
<Route author="WhoIsSure" example="/grandchallenge/challenges" path="/grandchallenge/challenges"/>
|
||||
|
||||
### 用户参加的 Challenge
|
||||
|
||||
<Route author="WhoIsSure" example="/grandchallenge/user/Isensee" path="/grandchallenge/user/:id" :paramsDesc="['用户ID,必选-用户页面网址里面的用户ID']"/>
|
||||
|
||||
## HackerOne
|
||||
|
||||
### HackerOne Hacker Activity
|
||||
|
||||
@@ -3453,4 +3453,10 @@ router.get('/wsj/:lang/:category', require('./routes/wsj/index'));
|
||||
// China File
|
||||
router.get('/chinafile/:category?', require('./routes/chinafile/index'));
|
||||
|
||||
// Grand-Challenge-user
|
||||
router.get('/grandchallenge/user/:id', require('./routes/grandchallenge/user'));
|
||||
|
||||
// Grand-Challenge-Challenges
|
||||
router.get('/grandchallenge/challenges', require('./routes/grandchallenge/challenges'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://grand-challenge.org/challenges',
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.card');
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Grand-Challenge-challenges',
|
||||
link: 'https://grand-challenge.org/challenges',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const itemPicUrl = item.find('img').attr('src');
|
||||
const description = item.find('a[data-description]').attr('data-description') || 'No description';
|
||||
return {
|
||||
title: item.find('h5').text(),
|
||||
description: `${description}<br><img src="${itemPicUrl}">`,
|
||||
link: item.find('.stretched-link').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://grand-challenge.org/users/${id}`,
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.card');
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${id}'s participations`,
|
||||
link: `https://grand-challenge.org/users/${id}`,
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const itemPicUrl = item.find('img').attr('src');
|
||||
const description = item.find('.card-text').text() || 'No description';
|
||||
return {
|
||||
title: item.find('h5').text(),
|
||||
description: `${description}<br><img src="${itemPicUrl}">`,
|
||||
link: item.find('.stretched-link').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user