From f1092152ee3960dc0aa422e7790f754942744fd9 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 30 May 2019 01:57:56 +0800 Subject: [PATCH] feat: remove weibo/user2, close #2169 --- docs/README.md | 2 +- docs/social-media.md | 12 +--------- lib/router.js | 1 - lib/routes/weibo/user2.js | 49 --------------------------------------- 4 files changed, 2 insertions(+), 62 deletions(-) delete mode 100644 lib/routes/weibo/user2.js diff --git a/docs/README.md b/docs/README.md index 99f79ad81..d48b97160 100755 --- a/docs/README.md +++ b/docs/README.md @@ -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 里的图片加载不出来?** diff --git a/docs/social-media.md b/docs/social-media.md index 4acce2efe..2d8331f0f 100644 --- a/docs/social-media.md +++ b/docs/social-media.md @@ -600,20 +600,10 @@ pageClass: routes ## 微博 -### 博主(方案 1) +### 博主 -::: warning 注意 - -上述方案 1 获取 V+ 付费博主会有数据缺失, 所以这里提供方案 2 , 这种方式的缺点是描述不如上面的完善, 建议优先选择第一种方案 - -::: - -### 博主(方案 2) - - - ### 关键词 diff --git a/lib/router.js b/lib/router.js index 588662fa5..13c1e0fa5 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/weibo/user2.js b/lib/routes/weibo/user2.js deleted file mode 100644 index 633f5a031..000000000 --- a/lib/routes/weibo/user2.js +++ /dev/null @@ -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, '
') - .replace(/(( ?)+
( ?)+){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, - }; -};