mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-14 01:00:38 +08:00
@@ -2527,3 +2527,7 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
|
|||||||
### 虎嗅
|
### 虎嗅
|
||||||
|
|
||||||
<route name="标签" author="xyqfer" example="/huxiu/tag/291" path="/huxiu/tag/:id" :paramsDesc="['标签 id']" />
|
<route name="标签" author="xyqfer" example="/huxiu/tag/291" path="/huxiu/tag/:id" :paramsDesc="['标签 id']" />
|
||||||
|
|
||||||
|
### 扇贝
|
||||||
|
|
||||||
|
<route name="打卡" author="DIYgod" example="/shanbay/checkin/ddwej" path="/shanbay/checkin/:id" :paramsDesc="['用户 id']" />
|
||||||
|
|||||||
@@ -900,4 +900,7 @@ router.get('/huxiu/tag/:id', require('./routes/huxiu/tag'));
|
|||||||
router.get('/steam/search/:params', require('./routes/steam/search'));
|
router.get('/steam/search/:params', require('./routes/steam/search'));
|
||||||
router.get('/steam/news/:appids', require('./routes/steam/news'));
|
router.get('/steam/news/:appids', require('./routes/steam/news'));
|
||||||
|
|
||||||
|
// 扇贝
|
||||||
|
router.get('/shanbay/checkin/:id', require('./routes/shanbay/checkin'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module.exports = async (ctx) => {
|
|||||||
const data = response.data.data.entries.reduce((all, current) => all.concat(current.entries));
|
const data = response.data.data.entries.reduce((all, current) => all.concat(current.entries));
|
||||||
|
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: `Keep 动态 - ${data[0].author.username}`,
|
title: `${data[0].author.username} 的 Keep 动态`,
|
||||||
link: `https://show.gotokeep.com/users/${id}`,
|
link: `https://show.gotokeep.com/users/${id}`,
|
||||||
language: 'zh-cn',
|
language: 'zh-cn',
|
||||||
item:
|
item:
|
||||||
|
|||||||
46
routes/shanbay/checkin.js
Normal file
46
routes/shanbay/checkin.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
const axios = require('axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const id = ctx.params.id;
|
||||||
|
|
||||||
|
const username = await ctx.cache.tryGet(`shanbayuser${id}`, async () => {
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: `https://web.shanbay.com/web/checkin/achievement?user_id=${id}`,
|
||||||
|
});
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
return $('#user-info-area .name').text();
|
||||||
|
});
|
||||||
|
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: `https://apiv3.shanbay.com/uc/checkin/logs?page=1&user_id=${id}`,
|
||||||
|
headers: {
|
||||||
|
Referer: `https://web.shanbay.com/web/wechat/calendar/?user_id=${id}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data.objects;
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${username} 的扇贝打卡`,
|
||||||
|
link: `https://web.shanbay.com/web/wechat/calendar/?user_id=${id}`,
|
||||||
|
item:
|
||||||
|
data &&
|
||||||
|
data.map((item) => {
|
||||||
|
let action = '';
|
||||||
|
item.tasks.forEach((task, index) => {
|
||||||
|
const minute = Math.floor(task.used_time / 60);
|
||||||
|
const second = task.used_time - minute * 60;
|
||||||
|
action += `${index === 0 ? '' : ';'}${task.operation}了 ${task.num} ${task.unit}${task.name},学习时间 ${minute} 分 ${second} 秒`;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
title: `${username} 的第 ${item.checkin_days_num} 天打卡`,
|
||||||
|
pubDate: new Date(`${item.date} 00:00:00+08`),
|
||||||
|
guid: item.id,
|
||||||
|
description: action,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user