feat: remove weibo/user2, close #2169

This commit is contained in:
DIYgod 2019-05-30 01:57:56 +08:00
parent f218807ed7
commit f1092152ee
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
4 changed files with 2 additions and 62 deletions

View File

@ -47,7 +47,7 @@ Logo designed by [sheldonrrr](https://dribbble.com/sheldonrrr)
**Q: 演示地址可以用么?**
**A:** 演示地址为 [rsshub.app](https://rsshub.app), 缓存时间 20 分钟, 可以随意使用。部分网站反爬策略严格,如微博、知乎、即刻,可能无法确保可用性,自建可以提高稳定性。
**A:** 演示地址为 [rsshub.app](https://rsshub.app), 缓存时间 20 分钟, 可以随意使用。部分网站反爬策略严格,如微博、知乎,可能无法确保可用性,自建可以提高稳定性。
**Q: 为什么 RSSHub 里的图片加载不出来?**

View File

@ -600,20 +600,10 @@ pageClass: routes
## 微博
### 博主(方案 1
### 博主
<Route author="DIYgod" example="/weibo/user/1195230310" path="/weibo/user/:uid" :paramsDesc="['用户 id, 博主主页打开控制台执行 `$CONFIG.oid` 获取']" crawlerBadge="1"/>
::: warning 注意
上述方案 1 获取 V+ 付费博主会有数据缺失, 所以这里提供方案 2 , 这种方式的缺点是描述不如上面的完善, 建议优先选择第一种方案
:::
### 博主(方案 2
<Route author="DIYgod" example="/weibo/user2/1195230310" path="/weibo/user2/:uid" :paramsDesc="['用户 id, 博主主页打开控制台执行 `$CONFIG.oid` 获取']"/>
### 关键词
<Route author="DIYgod" example="/weibo/keyword/DIYgod" path="/weibo/keyword/:keyword" :paramsDesc="['你想订阅的微博关键词']" crawlerBadge="1"/>

View File

@ -52,7 +52,6 @@ router.get('/bangumi/subject/:id', require('./routes/bangumi/subject'));
// 微博
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'));

View File

@ -1,49 +0,0 @@
const axios = require('@/utils/axios');
const cheerio = require('cheerio');
const date = require('@/utils/date');
module.exports = async (ctx) => {
const uid = ctx.params.uid;
const response = await axios({
method: 'get',
url: `http://service.weibo.com/widget/widget_blog.php?uid=${uid}`,
headers: {
Referer: `http://service.weibo.com/widget/widget_blog.php?uid=${uid}`,
},
});
const data = response.data;
const $ = cheerio.load(data, {
decodeEntities: false,
});
const wbs = [];
const items = $('.wgtCell');
let wb, item, titleEle;
items.each((index, ele) => {
wb = {};
item = $(ele);
titleEle = item.find('.wgtCell_txt');
wb.title = titleEle.text().trim();
if (wb.title === '') {
wb.title = '[图片]';
}
wb.description = titleEle
.html()
.trim()
.replace(/(\r\n|\r|\n)+/g, '<br>')
.replace(/(( ?)+<br>( ?)+){2,}/g, '')
.replace(/thumbnail/, 'large');
wb.pubDate = date(item.find('.link_d').html(), 8);
wb.link = item.find('.wgtCell_tm a').attr('href');
wbs.push(wb);
});
const name = $('.userNm').text();
ctx.state.data = {
title: `${name}的微博`,
link: `http://weibo.com/${uid}/`,
item: wbs,
};
};