mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
feat: 支持订阅微博超话 (#2007)
This commit is contained in:
@@ -180,6 +180,8 @@
|
||||
|
||||
<Route name="热搜榜" author="xyqfer" example="/weibo/search/hot" path="/weibo/search/hot" crawlerBadge="1"/>
|
||||
|
||||
<Route name="超话" author="zengxs" example="/weibo/super_index/1008084989d223732bf6f02f75ea30efad58a9" path="/weibo/super_index/:id" :paramsDesc="['超话ID']" crawlerBadge="1"/>
|
||||
|
||||
## 贴吧
|
||||
|
||||
<Route name="帖子列表" author="u3u" example="/tieba/forum/女图" path="/tieba/forum/:kw" :paramsDesc="['吧名']"/>
|
||||
|
||||
@@ -134,6 +134,7 @@ router.get('/weibo/user/:uid', require('./routes/weibo/user'));
|
||||
router.get('/weibo/user2/:uid', require('./routes/weibo/user2'));
|
||||
router.get('/weibo/keyword/:keyword', require('./routes/weibo/keyword'));
|
||||
router.get('/weibo/search/hot', require('./routes/weibo/search/hot'));
|
||||
router.get('/weibo/super_index/:id', require('./routes/weibo/super_index'));
|
||||
|
||||
// 贴吧
|
||||
router.get('/tieba/forum/:kw', require('./routes/tieba/forum'));
|
||||
|
||||
49
lib/routes/weibo/super_index.js
Normal file
49
lib/routes/weibo/super_index.js
Normal file
@@ -0,0 +1,49 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const weiboUtils = require('./utils');
|
||||
const date = require('../../utils/date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const res = await axios.get('https://m.weibo.cn/api/container/getIndex', {
|
||||
params: {
|
||||
containerid: `${id}_-_feed`,
|
||||
luicode: '10000011',
|
||||
lfid: `${id}_-_main`,
|
||||
},
|
||||
headers: {
|
||||
Referer: `https://m.weibo.cn/p/index?containerid=${id}_-_soul&luicode=10000011&lfid=${id}_-_main`,
|
||||
'MWeibo-Pwa': '1',
|
||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
});
|
||||
|
||||
const resultItems = [];
|
||||
|
||||
for (const card of res.data.data.cards) {
|
||||
if (!('card_group' in card)) {
|
||||
continue;
|
||||
}
|
||||
for (const mblogCard of card.card_group) {
|
||||
if (mblogCard.card_type === '9' && 'mblog' in mblogCard) {
|
||||
const mblog = mblogCard.mblog;
|
||||
const desc = weiboUtils.format(mblog);
|
||||
resultItems.push({
|
||||
title: desc.replace(/<img.*?>/g, '[图片]').replace(/<.*?>/g, ''),
|
||||
description: desc,
|
||||
author: mblog.user.screen_name,
|
||||
link: `https://weibo.com/${mblog.user.id}/${mblog.bid}`,
|
||||
pubDate: date(mblog.created_at, 8),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: `微博超话 - ${res.data.data.pageInfo.page_title}`,
|
||||
link: `https://weibo.com/p/${id}/super_index`,
|
||||
description: `#${res.data.data.pageInfo.page_title}# 的超话`,
|
||||
item: resultItems,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user