mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
增加: 刷屏 (#1153)
This commit is contained in:
@@ -2373,3 +2373,9 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
|
||||
| Mac | Google | Toys |
|
||||
|
||||
</route>
|
||||
|
||||
### 刷屏
|
||||
|
||||
<route name="最新" author="xyqfer" example="/weseepro/newest" path="/weseepro/newest"/>
|
||||
|
||||
<route name="朋友圈" author="xyqfer" example="/weseepro/circle" path="/weseepro/circle"/>
|
||||
|
||||
@@ -821,4 +821,8 @@ router.get('/idownloadblog', require('./routes/idownloadblog/index'));
|
||||
// 9to5
|
||||
router.get('/9to5/:type', require('./routes/9to5/subsite'));
|
||||
|
||||
// 刷屏
|
||||
router.get('/weseepro/newest', require('./routes/weseepro/newest'));
|
||||
router.get('/weseepro/circle', require('./routes/weseepro/circle'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
38
routes/weseepro/circle.js
Normal file
38
routes/weseepro/circle.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const axios = require('../../utils/axios');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: 'https://www.weseepro.com/api/v1/message/stream/circle/2?end_uuid=&field_uuid=hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh',
|
||||
});
|
||||
|
||||
const data = response.data.data.field_messages;
|
||||
|
||||
ctx.state.data = {
|
||||
title: '刷屏-朋友圈',
|
||||
link: 'https://www.weseepro.com',
|
||||
item: data.map((item) => {
|
||||
const description = `${item.message.account.name}: ${item.message.message_text.content}`;
|
||||
let imgs = '';
|
||||
|
||||
if (item.message.link) {
|
||||
imgs = item.message.link.url.split(',').reduce((imgs, img) => {
|
||||
imgs += `
|
||||
<img referrerpolicy="no-referrer" src="${img}"/>
|
||||
`;
|
||||
return imgs;
|
||||
}, '');
|
||||
}
|
||||
|
||||
return {
|
||||
title: description,
|
||||
link: `https://www.weseepro.com/v/ask?uuid=${item.message_uuid}`,
|
||||
description: `
|
||||
${description}<br><br>
|
||||
${imgs}
|
||||
`,
|
||||
pubDate: new Date(item.message.message_text.add_time).toUTCString(),
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
59
routes/weseepro/newest.js
Normal file
59
routes/weseepro/newest.js
Normal file
@@ -0,0 +1,59 @@
|
||||
const axios = require('../../utils/axios');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: 'https://www.weseepro.com/api/v1/message/ground/spam?pageNumber=1&pageSize=20',
|
||||
});
|
||||
|
||||
const data = response.data.data.data;
|
||||
const generateMessage = (message) => `
|
||||
<img referrerpolicy="no-referrer" src="${message.link.img_url}"/><br><br>
|
||||
<a href="${message.link.url}">${message.link.summary}</a><br><br>
|
||||
<strong>${message.topMessage.account.name}</strong>: ${message.topMessage.content.replace(/\n/g, '<br>')}<br><br>
|
||||
`;
|
||||
|
||||
ctx.state.data = {
|
||||
title: '刷屏-最新',
|
||||
link: 'https://www.weseepro.com',
|
||||
item: data.map((item) => {
|
||||
let title;
|
||||
let link;
|
||||
let description;
|
||||
let pubDate;
|
||||
|
||||
if (item.data.spam) {
|
||||
const spam = item.data.spam;
|
||||
|
||||
title = spam.content;
|
||||
link = `https://www.weseepro.com/mine/article?uuid=${spam.uuid}`;
|
||||
description = generateMessage(spam);
|
||||
pubDate = new Date(spam.spam_add_time).toUTCString();
|
||||
} else if (item.data.special) {
|
||||
const special = item.data.special;
|
||||
const specialMessages = item.data.special_messages;
|
||||
const messages = specialMessages.reduce((messages, message) => {
|
||||
messages += generateMessage(message);
|
||||
return messages;
|
||||
}, '');
|
||||
|
||||
title = special.title;
|
||||
link = `https://www.weseepro.com/mine/album?uuid=${special.uuid}`;
|
||||
description = `
|
||||
<img referrerpolicy="no-referrer" src="${special.image}"/><br><br>
|
||||
${special.description}<br><br>
|
||||
${messages}
|
||||
`;
|
||||
} else {
|
||||
title = description = '未知类型,请点击<a href="https://github.com/DIYgod/RSSHub/issues">链接</a>提交issue';
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
description,
|
||||
pubDate,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user