From f812e915a4a0d0f12b65d04051212d49fd477e4b Mon Sep 17 00:00:00 2001
From: DIYgod
Date: Tue, 19 Dec 2023 22:29:51 +0800
Subject: [PATCH] feat: remove notOperational routes - bbs
---
assets/radar-rules.js | 1 -
lib/radar-rules.js | 11 --
lib/router.js | 29 ---
lib/routes/91ddcc/stage.js | 48 -----
lib/routes/91ddcc/user.js | 45 -----
lib/routes/andyt/index.js | 36 ----
lib/routes/huawei/xinsheng/index.js | 61 ------
lib/routes/lingyi/index.js | 64 -------
lib/routes/lowendtalk/discussion.js | 43 -----
lib/routes/mi/board.js | 36 ----
lib/routes/newsmth/account.js | 39 ----
lib/routes/newsmth/section.js | 99 ----------
lib/routes/tianya/comments.js | 41 ----
lib/routes/tianya/index.js | 32 ----
lib/routes/tianya/user.js | 34 ----
lib/v2/2047/index.js | 55 ------
lib/v2/2047/maintainer.js | 3 -
lib/v2/2047/radar.js | 13 --
lib/v2/2047/router.js | 3 -
lib/v2/audiobar/latest.js | 53 -----
lib/v2/audiobar/maintainer.js | 3 -
lib/v2/audiobar/radar.js | 13 --
lib/v2/audiobar/router.js | 3 -
lib/v2/hjedd/article.js | 27 ---
lib/v2/hjedd/hot.js | 14 --
lib/v2/hjedd/latest.js | 14 --
lib/v2/hjedd/maintainer.js | 10 -
lib/v2/hjedd/news.js | 14 --
lib/v2/hjedd/notice.js | 14 --
lib/v2/hjedd/original.js | 14 --
lib/v2/hjedd/radar.js | 55 ------
lib/v2/hjedd/router.js | 10 -
lib/v2/hjedd/templates/attachment.art | 7 -
lib/v2/hjedd/top.js | 14 --
lib/v2/hjedd/utils.js | 111 -----------
lib/v2/mobilism/forums.js | 75 --------
lib/v2/mobilism/maintainer.js | 4 -
lib/v2/mobilism/portal.js | 54 ------
lib/v2/mobilism/radar.js | 23 ---
lib/v2/mobilism/router.js | 4 -
lib/v2/nmbxd1/forum.js | 58 ------
lib/v2/nmbxd1/maintainer.js | 3 -
lib/v2/nmbxd1/radar.js | 13 --
lib/v2/nmbxd1/router.js | 3 -
lib/v2/nmbxd1/templates/description.art | 65 -------
website/docs/routes/bbs.mdx | 244 +-----------------------
website/docs/routes/reading.mdx | 15 --
47 files changed, 3 insertions(+), 1627 deletions(-)
delete mode 100644 lib/routes/91ddcc/stage.js
delete mode 100644 lib/routes/91ddcc/user.js
delete mode 100644 lib/routes/andyt/index.js
delete mode 100644 lib/routes/huawei/xinsheng/index.js
delete mode 100644 lib/routes/lingyi/index.js
delete mode 100644 lib/routes/lowendtalk/discussion.js
delete mode 100644 lib/routes/mi/board.js
delete mode 100644 lib/routes/newsmth/account.js
delete mode 100644 lib/routes/newsmth/section.js
delete mode 100644 lib/routes/tianya/comments.js
delete mode 100644 lib/routes/tianya/index.js
delete mode 100644 lib/routes/tianya/user.js
delete mode 100644 lib/v2/2047/index.js
delete mode 100644 lib/v2/2047/maintainer.js
delete mode 100644 lib/v2/2047/radar.js
delete mode 100644 lib/v2/2047/router.js
delete mode 100644 lib/v2/audiobar/latest.js
delete mode 100644 lib/v2/audiobar/maintainer.js
delete mode 100644 lib/v2/audiobar/radar.js
delete mode 100644 lib/v2/audiobar/router.js
delete mode 100644 lib/v2/hjedd/article.js
delete mode 100644 lib/v2/hjedd/hot.js
delete mode 100644 lib/v2/hjedd/latest.js
delete mode 100644 lib/v2/hjedd/maintainer.js
delete mode 100644 lib/v2/hjedd/news.js
delete mode 100644 lib/v2/hjedd/notice.js
delete mode 100644 lib/v2/hjedd/original.js
delete mode 100644 lib/v2/hjedd/radar.js
delete mode 100644 lib/v2/hjedd/router.js
delete mode 100644 lib/v2/hjedd/templates/attachment.art
delete mode 100644 lib/v2/hjedd/top.js
delete mode 100644 lib/v2/hjedd/utils.js
delete mode 100644 lib/v2/mobilism/forums.js
delete mode 100644 lib/v2/mobilism/maintainer.js
delete mode 100644 lib/v2/mobilism/portal.js
delete mode 100644 lib/v2/mobilism/radar.js
delete mode 100644 lib/v2/mobilism/router.js
delete mode 100644 lib/v2/nmbxd1/forum.js
delete mode 100644 lib/v2/nmbxd1/maintainer.js
delete mode 100644 lib/v2/nmbxd1/radar.js
delete mode 100644 lib/v2/nmbxd1/router.js
delete mode 100644 lib/v2/nmbxd1/templates/description.art
diff --git a/assets/radar-rules.js b/assets/radar-rules.js
index b9f53d51b..acac24abb 100644
--- a/assets/radar-rules.js
+++ b/assets/radar-rules.js
@@ -119,7 +119,6 @@
},
'govopendata.com': { _name: '新闻联播文字版', cn: [{ title: '新闻联播文字版', docs: 'https://docs.rsshub.app/routes/traditional-media#xin-wen-lian-bo-wen-zi-ban', source: '/xinwenlianbo', target: '/xinwenlianbo/index' }] },
'steampowered.com': { _name: 'Steam', store: [{ title: 'search', docs: 'https://docs.rsshub.app/routes/game#steam', source: '/search/', target: (params, url) => `/steam/search/${new URL(url).searchParams}` }] },
- 'xiaomi.cn': { _name: '小米社区', www: [{ title: '圈子', docs: 'https://docs.rsshub.app/routes/bbs#xiao-mi-she-qu', source: '/board/:boardId', target: '/mi/bbs/board/:boardId' }] },
'suzhou.gov.cn': { _name: '苏州市政府', www: [{ title: '政府新闻', docs: 'https://docs.rsshub.app/routes/government#su-zhou-shi-ren-min-zheng-fu', source: '/szsrmzf/:uid/nav_list.', target: '/gov/suzhou/news/:uid' }] },
'mqube.net': {
_name: 'MQube',
diff --git a/lib/radar-rules.js b/lib/radar-rules.js
index 2a28b8762..d126c9701 100644
--- a/lib/radar-rules.js
+++ b/lib/radar-rules.js
@@ -311,17 +311,6 @@ module.exports = {
},
],
},
- 'xiaomi.cn': {
- _name: '小米社区',
- www: [
- {
- title: '圈子',
- docs: 'https://docs.rsshub.app/routes/bbs#xiao-mi-she-qu',
- source: '/board/:boardId',
- target: '/mi/bbs/board/:boardId',
- },
- ],
- },
'suzhou.gov.cn': {
_name: '苏州市政府',
www: [
diff --git a/lib/router.js b/lib/router.js
index 1318d27f2..5be63a519 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -138,7 +138,6 @@ router.get('/mi/crowdfunding', lazyloadRouteHandler('./routes/mi/crowdfunding'))
// router.get('/mi/youpin/crowdfunding', lazyloadRouteHandler('./routes/mi/youpin/crowdfunding'));
// router.get('/mi/youpin/new/:sort?', lazyloadRouteHandler('./routes/mi/youpin/new'));
router.get('/miui/:device/:type?/:region?', lazyloadRouteHandler('./routes/mi/miui/index'));
-router.get('/mi/bbs/board/:boardId', lazyloadRouteHandler('./routes/mi/board'));
// 纵横
router.get('/zongheng/chapter/:id', lazyloadRouteHandler('./routes/zongheng/chapter'));
@@ -1068,11 +1067,6 @@ router.get('/soul/posts/hot/:pid*', lazyloadRouteHandler('./routes/soul/hot'));
// 单向空间
router.get('/owspace/read/:type?', lazyloadRouteHandler('./routes/owspace/read'));
-// 天涯论坛
-router.get('/tianya/index/:type', lazyloadRouteHandler('./routes/tianya/index'));
-router.get('/tianya/user/:userid', lazyloadRouteHandler('./routes/tianya/user'));
-router.get('/tianya/comments/:userid', lazyloadRouteHandler('./routes/tianya/comments'));
-
// eleme
router.get('/eleme/open/announce', lazyloadRouteHandler('./routes/eleme/open/announce'));
router.get('/eleme/open-be/announce', lazyloadRouteHandler('./routes/eleme/open-be/announce'));
@@ -1133,9 +1127,6 @@ router.get('/cfan/news', lazyloadRouteHandler('./routes/cfan/news'));
// 奈菲影视
router.get('/nfmovies/:id?', lazyloadRouteHandler('./routes/nfmovies/index'));
-// 书友社区
-router.get('/andyt/:view?', lazyloadRouteHandler('./routes/andyt/index'));
-
// engadget
router.get('/engadget/:lang?', lazyloadRouteHandler('./routes/engadget/home'));
@@ -1700,10 +1691,6 @@ router.get('/changku/cate/:postid', lazyloadRouteHandler('./routes/changku/index
// 上海市生态环境局
router.get('/gov/shanghai/sthj', lazyloadRouteHandler('./routes/gov/shanghai/sthj'));
-// 才符
-router.get('/91ddcc/user/:user', lazyloadRouteHandler('./routes/91ddcc/user'));
-router.get('/91ddcc/stage/:stage', lazyloadRouteHandler('./routes/91ddcc/stage'));
-
// BookwalkerTW热门新书
router.get('/bookwalkertw/news', lazyloadRouteHandler('./routes/bookwalkertw/news'));
@@ -1778,10 +1765,6 @@ router.get('/hfut/tzgg', lazyloadRouteHandler('./routes/universities/hfut/tzgg')
// OneJAV
router.get('/onejav/:type/:key?', lazyloadRouteHandler('./routes/onejav/one'));
-// 水木社区
-router.get('/newsmth/account/:id', lazyloadRouteHandler('./routes/newsmth/account'));
-router.get('/newsmth/section/:section', lazyloadRouteHandler('./routes/newsmth/section'));
-
// Kotaku
router.get('/kotaku/story/:type', lazyloadRouteHandler('./routes/kotaku/story'));
@@ -1886,9 +1869,6 @@ router.get('/anki/changes', lazyloadRouteHandler('./routes/anki/changes'));
// 台湾中央通讯社
// router.get('/cna/:id?', lazyloadRouteHandler('./routes/cna/index'));
-// 华为心声社区
-router.get('/huawei/xinsheng/:caty?/:order?/:keyword?', lazyloadRouteHandler('./routes/huawei/xinsheng/index'));
-
// 守望先锋
router.get('/ow/patch', lazyloadRouteHandler('./routes/ow/patch'));
@@ -2060,9 +2040,6 @@ router.get('/deloitte/industries/:category?', lazyloadRouteHandler('./routes/del
// 复旦大学继续教育学院
router.get('/fudan/cce', lazyloadRouteHandler('./routes/universities/fudan/cce'));
-// LowEndTalk
-router.get('/lowendtalk/discussion/:id?', lazyloadRouteHandler('./routes/lowendtalk/discussion'));
-
// 无产者评论
router.get('/proletar/:type?/:id?', lazyloadRouteHandler('./routes/proletar/index'));
@@ -2122,9 +2099,6 @@ router.get('/xynu/zkb/:category', lazyloadRouteHandler('./routes/universities/xy
// DailyArt
router.get('/dailyart/:language?', lazyloadRouteHandler('./routes/dailyart/index'));
-// SCBOY
-router.get('/scboy/thread/:tid', lazyloadRouteHandler('./routes/scboy/thread'));
-
// 猿料
router.get('/yuanliao/:tag?/:sort?', lazyloadRouteHandler('./routes/yuanliao/index'));
@@ -2266,9 +2240,6 @@ router.get('/trakt/collection/:username/:type?', lazyloadRouteHandler('./routes/
// 全球化智库
router.get('/ccg/:category?', lazyloadRouteHandler('./routes/ccg/index'));
-// 灵异网
-router.get('/lingyi/:category', lazyloadRouteHandler('./routes/lingyi/index'));
-
// 歪脑读
router.get('/wainao-reads/all-articles', lazyloadRouteHandler('./routes/wainao/index'));
diff --git a/lib/routes/91ddcc/stage.js b/lib/routes/91ddcc/stage.js
deleted file mode 100644
index 18e2de85a..000000000
--- a/lib/routes/91ddcc/stage.js
+++ /dev/null
@@ -1,48 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-
-module.exports = async (ctx) => {
- const currentUrl = `https://sns.91ddcc.com/s/${ctx.params.stage}`;
- const response = await got({
- method: 'get',
- url: currentUrl,
- });
-
- const $ = cheerio.load(response.data);
- const list = $('div.log-box div.l-single')
- .slice(0, 5)
- .map((_, item) => {
- item = $(item);
- const a = item.find('div.word a.s-til');
- return {
- title: a.text(),
- link: `https://sns.91ddcc.com${a.attr('href')}`,
- pubDate: new Date(item.find('div.floor a.fr').text() + ' GMT+8').toUTCString(),
- author: item.find('div.floor a.fl').text(),
- };
- })
- .get();
-
- const items = await Promise.all(
- list.map((item) =>
- ctx.cache.tryGet(item.link, async () => {
- const detailResponse = await got({
- method: 'get',
- url: item.link,
- });
- const content = cheerio.load(detailResponse.data);
-
- item.description = content('div.article-con').html();
-
- return item;
- })
- )
- );
-
- ctx.state.data = {
- title: `${$('a.name').text()} - 才符`,
- link: currentUrl,
- item: items,
- description: $('div.bot-info').text(),
- };
-};
diff --git a/lib/routes/91ddcc/user.js b/lib/routes/91ddcc/user.js
deleted file mode 100644
index 0f2e377cd..000000000
--- a/lib/routes/91ddcc/user.js
+++ /dev/null
@@ -1,45 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-
-module.exports = async (ctx) => {
- const currentUrl = `https://sns.91ddcc.com/${ctx.params.user}`;
- const response = await got({
- method: 'get',
- url: currentUrl,
- });
-
- const $ = cheerio.load(response.data);
- const list = $('div.dynamic-single')
- .slice(0, 10)
- .map((_, item) => {
- item = $(item);
-
- const word = item.find('div.word');
- const detailTitle = item.find('p.detail-title').text();
-
- let link = currentUrl;
- let title = detailTitle || word.html();
-
- if (word.attr('onclick')) {
- link = `https://sns.91ddcc.com${word.attr('onclick').split("'")[1]}`;
- } else {
- title = item.find('div.fl').text().trim();
- }
-
- item.find('p.detail-title').remove();
-
- return {
- title,
- link,
- description: item.find('div.dynamic-content').html(),
- pubDate: new Date(item.attr('add-time') * 1000).toUTCString(),
- };
- })
- .get();
-
- ctx.state.data = {
- title: `${$('span.user-name').text()} - 才符`,
- link: currentUrl,
- item: list,
- };
-};
diff --git a/lib/routes/andyt/index.js b/lib/routes/andyt/index.js
deleted file mode 100644
index 25fec2e5f..000000000
--- a/lib/routes/andyt/index.js
+++ /dev/null
@@ -1,36 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-
-const baseUrl = 'https://andyt.cn/forum.php?mod=guide&view=';
-const host = 'https://andyt.cn/';
-const viewProps = {
- newthread: '最新发表',
- hot: '最新热门',
- digest: '最新精华',
- new: '最新回复',
-};
-
-module.exports = async (ctx) => {
- const view = ctx.params.view || 'newthread';
- const url = baseUrl + view;
- const response = await got({
- method: 'get',
- url,
- });
- const $ = cheerio.load(response.data);
-
- ctx.state.data = {
- title: `${viewProps[view]} - 书友社区`,
- link: url,
- description: `${viewProps[view]} - 书友社区`,
- item: $('.bm_c')
- .find('tbody')
- .map((index, item) => ({
- title: `【` + $(item).find('td.by a').eq(0).text() + `】` + $(item).find('a.xst').text(),
- description: '',
- author: $(item).find('cite').text().trim(),
- link: host + $(item).find('a').eq(0).attr('href'),
- }))
- .get(),
- };
-};
diff --git a/lib/routes/huawei/xinsheng/index.js b/lib/routes/huawei/xinsheng/index.js
deleted file mode 100644
index 614f4fbe5..000000000
--- a/lib/routes/huawei/xinsheng/index.js
+++ /dev/null
@@ -1,61 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-
-module.exports = async (ctx) => {
- ctx.params.order = ctx.params.order || '';
- ctx.params.keyword = ctx.params.keyword || '';
- ctx.params.caty = ctx.params.caty || '';
-
- const rootUrl = `http://xinsheng.huawei.com/cn/index.php?app=forum&mod=List&class=461&order=${ctx.params.order}&search=${ctx.params.keyword}&cate=${ctx.params.caty}`;
- const response = await got({
- method: 'get',
- url: rootUrl,
- });
- const $ = cheerio.load(response.data);
-
- $('a[linktag="__subject_link__"]').remove();
-
- const list = $('.bbs_list ul li .font_box .title p font a')
- .slice(0, 15)
- .map((_, item) => {
- item = $(item);
- return {
- title: item.attr('title'),
- link: item.attr('href'),
- };
- })
- .get();
-
- const items = await Promise.all(
- list.map((item) =>
- ctx.cache.tryGet(item.link, async () => {
- const detailResponse = await got({
- method: 'get',
- url: item.link,
- });
- const content = cheerio.load(detailResponse.data);
-
- item.description = content('.bbs_info_right_text').eq(0).html();
- item.pubDate = new Date(content('span.fl').eq(0).text().trim() + ' GMT+8').toUTCString();
- item.author = content('.bbs_info_user_ a').eq(1).text();
-
- return item;
- })
- )
- );
-
- let title;
-
- $('.bbs_list_box_title_wz ul li').each(function () {
- if ($(this).hasClass('on')) {
- title = $(this).text();
- return;
- }
- });
-
- ctx.state.data = {
- title: `${title} - 华为家事 - 心声社区`,
- link: rootUrl,
- item: items,
- };
-};
diff --git a/lib/routes/lingyi/index.js b/lib/routes/lingyi/index.js
deleted file mode 100644
index 4b820e059..000000000
--- a/lib/routes/lingyi/index.js
+++ /dev/null
@@ -1,64 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-
-module.exports = async (ctx) => {
- const categories = {
- tuijian: '编辑推荐',
- lingyishijian: '灵异事件',
- guihualianpian: '鬼话连篇',
- minjianqitan: '民间奇谈',
- qiwenyishi: '奇闻异事',
- lingyitupian: '灵异图片',
- };
- const url = `http://www.lingyi.org/topics/${ctx.params.category}`;
- const res = await got({
- method: 'get',
- url,
- });
- const $ = cheerio.load(res.data);
- const resultItem = $('.post-list-item')
- .map((index, li) => {
- const elem = $(li);
- return {
- title: elem.find('h2').text(),
- description: elem.find('.post-excerpt').text(),
- link: elem.find('h2 a').attr('href'),
- image: elem.find('.mobile-show > div > a > picture > img').attr('href'),
- pubDate: elem.find('time').attr('datetime'),
- author: elem.find('.post-list-meta-user>a>span').text(),
- };
- })
- .get();
-
- const out = await Promise.all(
- resultItem.map(async (link) => {
- const pageUrl = link.link;
- const cache = await ctx.cache.get(link);
- if (cache) {
- return Promise.resolve(JSON.parse(cache));
- }
- const response = await got({
- method: 'get',
- url: pageUrl,
- headers: {
- Referer: url,
- },
- });
- const $1 = cheerio.load(response.data);
- const single = {
- pubDate: link.pubDate,
- link: link.link,
- title: link.title,
- description: $1('.entry-content').html(),
- };
- ctx.cache.set(link.link, JSON.stringify(single));
- return Promise.resolve(single);
- })
- );
-
- ctx.state.data = {
- title: `${categories[ctx.params.category]} - 中国灵异网`,
- link: url,
- item: out,
- };
-};
diff --git a/lib/routes/lowendtalk/discussion.js b/lib/routes/lowendtalk/discussion.js
deleted file mode 100644
index 148dabdb1..000000000
--- a/lib/routes/lowendtalk/discussion.js
+++ /dev/null
@@ -1,43 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-
-module.exports = async (ctx) => {
- const rootUrl = 'https://www.lowendtalk.com';
- const currentUrl = `${rootUrl}/discussion/${ctx.params.id}`;
- let response = await got({
- method: 'get',
- url: currentUrl,
- });
-
- let $ = cheerio.load(response.data);
-
- response = await got({
- method: 'get',
- url: $('.LastPage').attr('href'),
- });
-
- $ = cheerio.load(response.data);
-
- const items = $('.userContent')
- .map((_, item) => {
- item = $(item);
-
- const header = item.parent().parent().prev();
- const pubDate = header.find('time');
-
- return {
- description: item.html(),
- pubDate: pubDate.attr('datetime'),
- author: header.find('.Author').text(),
- link: `${rootUrl}${pubDate.parent().attr('href')}`,
- title: `${header.find('.Author').text().trim()}: ${item.text()}`,
- };
- })
- .get();
-
- ctx.state.data = {
- title: $('h1').eq(0).text(),
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/routes/mi/board.js b/lib/routes/mi/board.js
deleted file mode 100644
index fc9616925..000000000
--- a/lib/routes/mi/board.js
+++ /dev/null
@@ -1,36 +0,0 @@
-const got = require('@/utils/got');
-
-module.exports = async (ctx) => {
- const boardId = ctx.params.boardId;
- const link = `https://www.xiaomi.cn/board/${boardId}`;
-
- const response = await got({
- method: 'get',
- url: `https://prod.api.xiaomi.cn/community/board/home/announce/list?after=&limit=20&boardId=${boardId}`,
- headers: {
- Referer: link,
- },
- });
- const data = response.data.entity.records;
- const name = data[0].boards[0].boardName;
-
- ctx.state.data = {
- title: name + '-小米社区',
- link,
- item: data.map((item) => {
- let picTpl = '';
- if (item.picList && item.picList.length) {
- item.picList.forEach((pic) => {
- picTpl += ``;
- });
- }
- return {
- title: item.title || item.textContent,
- description: item.textContent + picTpl,
- pubDate: new Date(item.createTime).toUTCString(),
- author: item.author.name,
- link: `https://www.xiaomi.cn/post/${item.id}`,
- };
- }),
- };
-};
diff --git a/lib/routes/newsmth/account.js b/lib/routes/newsmth/account.js
deleted file mode 100644
index 58e500b66..000000000
--- a/lib/routes/newsmth/account.js
+++ /dev/null
@@ -1,39 +0,0 @@
-const url = require('url');
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const date = require('@/utils/date');
-
-module.exports = async (ctx) => {
- const rootUrl = `https://exp.newsmth.net`;
- const currentUrl = `${rootUrl}/account/${ctx.params.id}`;
-
- const response = await got({
- method: 'get',
- url: currentUrl,
- });
- const $ = cheerio.load(response.data);
-
- const list = $('ul.article-list li')
- .slice(0, 10)
- .map((_, item) => {
- item = $(item);
- const a = item.find('a.article-subject');
- const pubDate = date(item.find('div.article-time').text());
-
- item.find('div.article-time').remove();
-
- return {
- title: a.text(),
- link: url.resolve(rootUrl, a.attr('href')),
- description: item.find('div.article-main').html(),
- pubDate,
- };
- })
- .get();
-
- ctx.state.data = {
- title: $('title').text(),
- link: currentUrl,
- item: list,
- };
-};
diff --git a/lib/routes/newsmth/section.js b/lib/routes/newsmth/section.js
deleted file mode 100644
index 5f1369ba0..000000000
--- a/lib/routes/newsmth/section.js
+++ /dev/null
@@ -1,99 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const date = require('@/utils/date');
-
-const config = {
- community: {
- link: '/section/7fba65e45f678eb8c605d4107de04185',
- title: '社区管理',
- },
- university: {
- link: '/section/4fcab28694a0be93d9297d8cede052d9',
- title: '国内院校',
- },
- entertainment: {
- link: '/section/3497e48bb537373d0f738b41fe53a41b',
- title: '休闲娱乐',
- },
- location: {
- link: '/section/353fdfda1dfe7a714e592bab99c762cd',
- title: '五湖四海',
- },
- game: {
- link: '/section/c8d614e56acb8a192ec4af8b375a5eea',
- title: '游戏运动',
- },
- society: {
- link: '/section/5b634fdc9ecddf6042561c959176c077',
- title: '社会信息',
- },
- romance: {
- link: '/section/1c455a5dccf4242008d188f9676e3f4e',
- title: '知性感性',
- },
- culture: {
- link: '/section/12af235486fde6684e4b9e83f5d2b779',
- title: '文化人文',
- },
- science: {
- link: '/section/4ed7f0d8b621c8ccf9e11eca9991d6dc',
- title: '学术科学',
- },
- technology: {
- link: '/section/4dda79c64b3ffb61f8048d745292ff5d',
- title: '电脑技术',
- },
-};
-
-module.exports = async (ctx) => {
- const cfg = config[ctx.params.section];
- if (!cfg) {
- throw Error('Bad section. See docs');
- }
-
- const rootUrl = `https://exp.newsmth.net/statistics/hot`;
- const currentUrl = `${rootUrl}${cfg.link}`;
-
- const response = await got({
- method: 'get',
- url: currentUrl,
- });
- const $ = cheerio.load(response.data);
-
- const list = $('ul.article-list li')
- .slice(0, 15)
- .map((_, item) => {
- item = $(item);
- const a = item.find('a.article-subject');
- const pubDate = date(item.find('div.article-account-name span').text());
-
- return {
- title: a.text(),
- link: `https://exp.newsmth.net${a.attr('href')}`,
- pubDate,
- };
- })
- .get();
-
- const items = await Promise.all(
- list.map((item) =>
- ctx.cache.tryGet(item.link, async () => {
- const detailResponse = await got({
- method: 'get',
- url: item.link,
- });
- const content = cheerio.load(detailResponse.data);
-
- item.description = content('div.show-content').html();
-
- return item;
- })
- )
- );
-
- ctx.state.data = {
- title: cfg.title + ' - 水木社区',
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/routes/tianya/comments.js b/lib/routes/tianya/comments.js
deleted file mode 100644
index f31741904..000000000
--- a/lib/routes/tianya/comments.js
+++ /dev/null
@@ -1,41 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-
-module.exports = async (ctx) => {
- const { userid } = ctx.params;
- const url = 'http://www.tianya.cn/' + userid + '/bbs?t=post';
- const responseraw = await got(url, { headers: { Referer: 'http://bbs.tianya.cn' } });
- const $ = cheerio.load(responseraw.data);
- const username = $('div.portrait h2 a').first().text();
-
- const turl = `http://www.tianya.cn/api/bbsuser?method=userinfo.ice.getUserTotalReplyList¶ms.userId=${userid}¶ms.pageSize=20¶ms.bMore=true`;
- const response = await got(turl, { headers: { Referer: 'http://bbs.tianya.cn' } });
- const json = response.data;
- const items = await Promise.all(
- json.data.rows.map(async (ele) => {
- const title = ele.title;
- const link = `http://bbs.tianya.cn/go_reply_position.jsp?item=${ele.item}&id=${ele.art_id}&rid=${ele.reply_id}`;
- const date = ele.reply_time;
-
- const commentData = await ctx.cache.tryGet(link, async () => {
- const commentResponse = await got(link, { headers: { Referer: 'http://bbs.tianya.cn' } });
- const res = cheerio.load(commentResponse.data)(`div[replyid='${ele.reply_id}'] div.atl-content div.bbs-content`).html();
- return res;
- });
-
- const pubDate = new Date(date).toUTCString();
- return Promise.resolve({
- title,
- description: commentData,
- link,
- pubDate,
- });
- })
- );
- ctx.state.data = {
- title: username + '的天涯回帖',
- description: username,
- link: url,
- item: items,
- };
-};
diff --git a/lib/routes/tianya/index.js b/lib/routes/tianya/index.js
deleted file mode 100644
index a73f41fc7..000000000
--- a/lib/routes/tianya/index.js
+++ /dev/null
@@ -1,32 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-
-module.exports = async (ctx) => {
- const { type } = ctx.params;
- const url = 'http://bbs.tianya.cn/list-' + type + '-1.shtml';
- const response = await got(url, { headers: { Referer: 'http://bbs.tianya.cn' } });
- const $ = cheerio.load(response.data);
- const typeTitle = $('div.location div.text strong').text();
- const items = $('table > tbody ~ tbody > tr')
- .map((_, ele) => {
- const $item = cheerio.load(ele);
- const title = $item('td.td-title a').text();
- const link = 'http://bbs.tianya.cn' + $item('td.td-title a').attr('href');
- const date = $item('td').last().attr('title');
-
- const pubDate = new Date(date).toUTCString();
- return {
- title,
- description: title,
- link,
- pubDate,
- };
- })
- .get();
- ctx.state.data = {
- title: typeTitle,
- description: typeTitle,
- link: url,
- item: items,
- };
-};
diff --git a/lib/routes/tianya/user.js b/lib/routes/tianya/user.js
deleted file mode 100644
index 5ed6b8247..000000000
--- a/lib/routes/tianya/user.js
+++ /dev/null
@@ -1,34 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-
-module.exports = async (ctx) => {
- const { userid } = ctx.params;
- const url = 'http://www.tianya.cn/' + userid + '/bbs?t=post';
- const responseraw = await got(url, { headers: { Referer: 'http://bbs.tianya.cn' } });
- const $ = cheerio.load(responseraw.data);
- const username = $('div.portrait h2 a').first().text();
-
- const turl = `http://www.tianya.cn/api/bbsuser?method=userinfo.ice.getUserTotalArticleList¶ms.userId=${userid}¶ms.pageSize=20¶ms.bMore=true`;
- const response = await got(turl, { headers: { Referer: 'http://bbs.tianya.cn' } });
- const json = response.data;
- const items = json.data.rows.map((ele) => {
- const title = ele.title;
- const clicknum = ` 点击数:${ele.click_counter},回复数:${ele.reply_counter}`;
- const link = `http://bbs.tianya.cn/post-${ele.item}-${ele.art_id}-1.shtml`;
- const date = ele.compose_time;
-
- const pubDate = new Date(date).toUTCString();
- return {
- title,
- description: title + clicknum,
- link,
- pubDate,
- };
- });
- ctx.state.data = {
- title: username + '的天涯帖子',
- description: username,
- link: url,
- item: items,
- };
-};
diff --git a/lib/v2/2047/index.js b/lib/v2/2047/index.js
deleted file mode 100644
index b196e45cd..000000000
--- a/lib/v2/2047/index.js
+++ /dev/null
@@ -1,55 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const { parseDate } = require('@/utils/parse-date');
-
-module.exports = async (ctx) => {
- const category = ctx.params.category ?? '';
- const sort = ctx.params.sort ?? '';
-
- const rootUrl = 'https://2047.name';
- const currentUrl = `${rootUrl}${category ? `/c/${category}` : ''}${sort ? `?sortby=${sort}` : ''}`;
-
- const response = await got({
- method: 'get',
- url: currentUrl,
- });
-
- const $ = cheerio.load(response.data);
-
- const list = $('.threadlist_title')
- .slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 50)
- .map((_, item) => {
- item = $(item);
-
- return {
- title: item.text(),
- link: `${rootUrl}${item.attr('href')}`,
- };
- })
- .get();
-
- const items = await Promise.all(
- list.map((item) =>
- ctx.cache.tryGet(item.link, async () => {
- const detailResponse = await got({
- method: 'get',
- url: item.link,
- });
-
- const content = cheerio.load(detailResponse.data);
-
- item.description = content('.post_content').eq(0).html();
- item.author = content('meta[property="og:article:author"]').attr('content');
- item.pubDate = parseDate(content('meta[property="og:article:published_time"]').attr('content'));
-
- return item;
- })
- )
- );
-
- ctx.state.data = {
- title: $('title').text(),
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/v2/2047/maintainer.js b/lib/v2/2047/maintainer.js
deleted file mode 100644
index 1b0a5930b..000000000
--- a/lib/v2/2047/maintainer.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = {
- '/:category?/:sort?': ['nczitzk'],
-};
diff --git a/lib/v2/2047/radar.js b/lib/v2/2047/radar.js
deleted file mode 100644
index 95601e2d7..000000000
--- a/lib/v2/2047/radar.js
+++ /dev/null
@@ -1,13 +0,0 @@
-module.exports = {
- '2047.name': {
- _name: '2047',
- '.': [
- {
- title: '分类',
- docs: 'https://docs.rsshub.app/routes/bbs#2047-fen-lei',
- source: ['/'],
- target: '/2047/:category?/:sort?',
- },
- ],
- },
-};
diff --git a/lib/v2/2047/router.js b/lib/v2/2047/router.js
deleted file mode 100644
index 6456aa730..000000000
--- a/lib/v2/2047/router.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = function (router) {
- router.get('/:category?/:sort?', require('./index'));
-};
diff --git a/lib/v2/audiobar/latest.js b/lib/v2/audiobar/latest.js
deleted file mode 100644
index cde096afc..000000000
--- a/lib/v2/audiobar/latest.js
+++ /dev/null
@@ -1,53 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const iconv = require('iconv-lite');
-const { parseDate } = require('@/utils/parse-date');
-const timezone = require('@/utils/timezone');
-
-const rootUrl = 'http://www.audiobar.cn/';
-
-module.exports = async (ctx) => {
- const currentUrl = `${rootUrl}/all.php`;
-
- const response = await got({
- method: 'get',
- url: currentUrl,
- responseType: 'buffer',
- });
- const data = iconv.decode(response.data, 'gb2312');
- const $ = cheerio.load(data);
-
- const list = $('.thread_every_container_div')
- .map((_, item) => {
- item = $(item);
-
- const link = item.find('.thread_subject').attr('href');
- const dateStr = item.find('.atrd_span').text().slice(-26).replace(' ', '');
- return {
- title: item.find('.thread_subject').text().replace('\n', '').replace(' ', ''),
- link: link.indexOf('http') > -1 ? link : `${rootUrl}${link}`,
- pubDate: timezone(parseDate(dateStr, 'YY-M-D HH:mm'), +8),
- };
- })
- .get();
- const items = await Promise.all(
- list.map((item) =>
- ctx.cache.tryGet(item.link, async () => {
- const detailResponse = await got({
- method: 'get',
- url: item.link,
- responseType: 'buffer',
- });
- const detailResponsedata = iconv.decode(detailResponse.data, 'gb2312');
- const content = cheerio.load(detailResponsedata);
- item.description = content('.zhengwen_div').text().replace('Your browser does not support HTML5, please change another browser.', '');
- return item;
- })
- )
- );
- ctx.state.data = {
- title: '音频应用-最新主题',
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/v2/audiobar/maintainer.js b/lib/v2/audiobar/maintainer.js
deleted file mode 100644
index 2791d6cae..000000000
--- a/lib/v2/audiobar/maintainer.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = {
- '/latest': ['zxzhuty'],
-};
diff --git a/lib/v2/audiobar/radar.js b/lib/v2/audiobar/radar.js
deleted file mode 100644
index 2d4919272..000000000
--- a/lib/v2/audiobar/radar.js
+++ /dev/null
@@ -1,13 +0,0 @@
-module.exports = {
- 'audiobar.cn': {
- _name: '音频应用',
- '.': [
- {
- title: '最新主题',
- docs: 'https://docs.rsshub.app/routes/bbs#yin-pin-ying-yong',
- source: ['/all.php'],
- target: '/audiobar/latest',
- },
- ],
- },
-};
diff --git a/lib/v2/audiobar/router.js b/lib/v2/audiobar/router.js
deleted file mode 100644
index c7599855e..000000000
--- a/lib/v2/audiobar/router.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = function (router) {
- router.get('/latest', require('./latest'));
-};
diff --git a/lib/v2/hjedd/article.js b/lib/v2/hjedd/article.js
deleted file mode 100644
index 9f8ce2a3c..000000000
--- a/lib/v2/hjedd/article.js
+++ /dev/null
@@ -1,27 +0,0 @@
-const got = require('@/utils/got');
-const { rootUrl, ProcessItems } = require('./utils');
-
-module.exports = async (ctx) => {
- const node = ctx.params.node ?? '258';
- const type = ctx.params.type ?? '1';
-
- const currentUrl = rootUrl;
- const nodeUrl = `${rootUrl}/api/topic/node?nodeId=${node}`;
- const apiUrl = `${rootUrl}/api/topic/node/topics?page=1&nodeId=${node}&type=${type}&limit=${ctx.query.limit}`;
-
- const response = await got({
- method: 'get',
- url: nodeUrl,
- });
-
- const data = response.data.data;
-
- const items = await ProcessItems(apiUrl, ctx.query.limit, ctx.cache.tryGet);
-
- ctx.state.data = {
- title: `海角社区 - ${data.name}`,
- link: `${currentUrl}/article?nodeId=${node}`,
- item: items,
- description: data.description.replace(/<\/?p>/, ''),
- };
-};
diff --git a/lib/v2/hjedd/hot.js b/lib/v2/hjedd/hot.js
deleted file mode 100644
index 06b8f591d..000000000
--- a/lib/v2/hjedd/hot.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const { rootUrl, ProcessItems } = require('./utils');
-
-module.exports = async (ctx) => {
- const currentUrl = rootUrl;
- const apiUrl = `${rootUrl}/api/topic/hot/topics?page=1`;
-
- const items = await ProcessItems(apiUrl, ctx.query.limit, ctx.cache.tryGet);
-
- ctx.state.data = {
- title: '海角社区 - 热门',
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/v2/hjedd/latest.js b/lib/v2/hjedd/latest.js
deleted file mode 100644
index 51371ef66..000000000
--- a/lib/v2/hjedd/latest.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const { rootUrl, ProcessItems } = require('./utils');
-
-module.exports = async (ctx) => {
- const currentUrl = rootUrl;
- const apiUrl = `${rootUrl}/api/topic/node/topics?page=1&nodeId=0&type=1`;
-
- const items = await ProcessItems(apiUrl, ctx.query.limit, ctx.cache.tryGet);
-
- ctx.state.data = {
- title: '海角社区 - 最新',
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/v2/hjedd/maintainer.js b/lib/v2/hjedd/maintainer.js
deleted file mode 100644
index e9aa425fd..000000000
--- a/lib/v2/hjedd/maintainer.js
+++ /dev/null
@@ -1,10 +0,0 @@
-module.exports = {
- '/event': ['nczitzk'],
- '/hot': ['nczitzk'],
- '/latest': ['nczitzk'],
- '/news': ['nczitzk'],
- '/notice': ['nczitzk'],
- '/original': ['nczitzk'],
- '/top': ['nczitzk'],
- '/:node?/:type?': ['nczitzk'],
-};
diff --git a/lib/v2/hjedd/news.js b/lib/v2/hjedd/news.js
deleted file mode 100644
index 8f2b0fa45..000000000
--- a/lib/v2/hjedd/news.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const { rootUrl, ProcessItems } = require('./utils');
-
-module.exports = async (ctx) => {
- const currentUrl = rootUrl;
- const apiUrl = `${rootUrl}/api/topic/node/news?page=1`;
-
- const items = await ProcessItems(apiUrl, ctx.query.limit, ctx.cache.tryGet);
-
- ctx.state.data = {
- title: '海角社区 - 新闻',
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/v2/hjedd/notice.js b/lib/v2/hjedd/notice.js
deleted file mode 100644
index fa8dbc94c..000000000
--- a/lib/v2/hjedd/notice.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const { rootUrl, ProcessItems } = require('./utils');
-
-module.exports = async (ctx) => {
- const currentUrl = rootUrl;
- const apiUrl = `${rootUrl}/api/topic/node/topics?page=1&nodeId=14&type=0`;
-
- const items = await ProcessItems(apiUrl, ctx.query.limit, ctx.cache.tryGet);
-
- ctx.state.data = {
- title: '海角社区 - 公告',
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/v2/hjedd/original.js b/lib/v2/hjedd/original.js
deleted file mode 100644
index 9b7e0b236..000000000
--- a/lib/v2/hjedd/original.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const { rootUrl, ProcessItems } = require('./utils');
-
-module.exports = async (ctx) => {
- const currentUrl = rootUrl;
- const apiUrl = `${rootUrl}/api/topic/node/topics?page=1&type=7`;
-
- const items = await ProcessItems(apiUrl, ctx.query.limit, ctx.cache.tryGet);
-
- ctx.state.data = {
- title: '海角社区 - 原创',
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/v2/hjedd/radar.js b/lib/v2/hjedd/radar.js
deleted file mode 100644
index a98585a30..000000000
--- a/lib/v2/hjedd/radar.js
+++ /dev/null
@@ -1,55 +0,0 @@
-module.exports = {
- 'hjedd.com': {
- _name: '海角社区',
- '.': [
- {
- title: '热门',
- docs: 'https://docs.rsshub.app/routes/bbs#hai-jiao-she-qu-re-men',
- source: ['/'],
- target: '/hjedd/hot',
- },
- {
- title: '新闻',
- docs: 'https://docs.rsshub.app/routes/bbs#hai-jiao-she-qu-xin-wen',
- source: ['/'],
- target: '/hjedd/news',
- },
- {
- title: '大事记',
- docs: 'https://docs.rsshub.app/routes/bbs#hai-jiao-she-qu-da-shi-ji',
- source: ['/article', '/'],
- target: '/hjedd/event',
- },
- {
- title: '原创',
- docs: 'https://docs.rsshub.app/routes/bbs#hai-jiao-she-qu-da-yuan-chuang',
- source: ['/'],
- target: '/hjedd/original',
- },
- {
- title: '精华',
- docs: 'https://docs.rsshub.app/routes/bbs#hai-jiao-she-qu-da-jing-hua',
- source: ['/'],
- target: '/hjedd/top',
- },
- {
- title: '公告',
- docs: 'https://docs.rsshub.app/routes/bbs#hai-jiao-she-qu-da-gong-gao',
- source: ['/'],
- target: '/hjedd/notice',
- },
- {
- title: '最新',
- docs: 'https://docs.rsshub.app/routes/bbs#hai-jiao-she-qu-da-zui-xin',
- source: ['/'],
- target: '/hjedd/latest',
- },
- {
- title: '文章',
- docs: 'https://docs.rsshub.app/routes/bbs#hai-jiao-she-qu-da-wen-zhang',
- source: ['/article', '/'],
- target: (params, url) => `/hjedd/${new URL(url).searchParams.get('nodeId')}`,
- },
- ],
- },
-};
diff --git a/lib/v2/hjedd/router.js b/lib/v2/hjedd/router.js
deleted file mode 100644
index be70f344e..000000000
--- a/lib/v2/hjedd/router.js
+++ /dev/null
@@ -1,10 +0,0 @@
-module.exports = function (router) {
- router.get('/event', require('./article'));
- router.get('/hot', require('./hot'));
- router.get('/latest', require('./latest'));
- router.get('/news', require('./news'));
- router.get('/notice', require('./notice'));
- router.get('/original', require('./original'));
- router.get('/top', require('./top'));
- router.get('/:node?/:type?', require('./article'));
-};
diff --git a/lib/v2/hjedd/templates/attachment.art b/lib/v2/hjedd/templates/attachment.art
deleted file mode 100644
index 1040ad640..000000000
--- a/lib/v2/hjedd/templates/attachment.art
+++ /dev/null
@@ -1,7 +0,0 @@
-{{ if attachment.category == 'video' }}
-
-{{ else }}
-
-{{ /if }}
\ No newline at end of file
diff --git a/lib/v2/hjedd/top.js b/lib/v2/hjedd/top.js
deleted file mode 100644
index aa3d8218b..000000000
--- a/lib/v2/hjedd/top.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const { rootUrl, ProcessItems } = require('./utils');
-
-module.exports = async (ctx) => {
- const currentUrl = rootUrl;
- const apiUrl = `${rootUrl}/api/topic/node/topics?page=1&nodeId=0&type=3`;
-
- const items = await ProcessItems(apiUrl, ctx.query.limit, ctx.cache.tryGet);
-
- ctx.state.data = {
- title: '海角社区 - 精华',
- link: currentUrl,
- item: items,
- };
-};
diff --git a/lib/v2/hjedd/utils.js b/lib/v2/hjedd/utils.js
deleted file mode 100644
index 0f5f8425f..000000000
--- a/lib/v2/hjedd/utils.js
+++ /dev/null
@@ -1,111 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const asyncPool = require('tiny-async-pool');
-const timezone = require('@/utils/timezone');
-const { parseDate } = require('@/utils/parse-date');
-const { art } = require('@/utils/render');
-const path = require('path');
-
-const rootUrl = 'https://www.hjedd.com';
-
-const decodeImage = (text) => {
- const e = 'ABCD*EFGHIJKLMNOPQRSTUVWX#YZabcdefghijklmnopqrstuvwxyz1234567890';
-
- let a,
- o,
- i,
- r,
- c,
- s,
- u = '',
- image = '',
- index = 0;
-
- text = text.replace(/[^A-Za-z0-9*#]/g, '');
-
- while (index < text.length) {
- r = e.indexOf(text.charAt(index++));
- c = e.indexOf(text.charAt(index++));
- s = e.indexOf(text.charAt(index++));
- u = e.indexOf(text.charAt(index++));
- a = (r << 2) | (c >> 4);
- o = ((15 & c) << 4) | (s >> 2);
- i = ((3 & s) << 6) | u;
- image += String.fromCharCode(a);
- 64 !== s && (image += String.fromCharCode(o));
- 64 !== u && (image += String.fromCharCode(i));
- }
-
- return image;
-};
-
-module.exports = {
- rootUrl,
- ProcessItems: async (apiUrl, limit, tryGet) => {
- const response = await got({
- method: 'get',
- url: apiUrl,
- });
-
- const list = response.data.data.results.slice(0, limit ? parseInt(limit) : 20).map((item) => ({
- guid: item.topicId,
- title: item.title,
- link: `${rootUrl}/post/details?pid=${item.topicId}`,
- category: item.node?.name ?? [],
- author: item.user.nickname,
- pubDate: timezone(parseDate(item.createTime), +8),
- description: item.liteContent ? `
${item.liteContent}
` : '', - })); - - const items = []; - for await (const item of asyncPool(5, list, (item) => - tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: `https://www.hjedd.com/api/topic/${item.guid}`, - }); - - const content = cheerio.load(detailResponse.data.data.content); - - content('.sell-btn').remove(); - - const attachments = detailResponse.data.data.attachments ?? []; - - for await (const attachment of asyncPool(5, attachments, (attachment) => - tryGet(attachment.remoteUrl, async () => { - const attachmentResponse = await got({ - method: 'get', - url: attachment.coverUrl ?? attachment.remoteUrl, - }); - - attachment.data = decodeImage(attachmentResponse.data); - - return attachment; - }) - )) { - if (content(`[data-id="${attachment.id}"]`).length === 0) { - content('body').append( - art(path.join(__dirname, 'templates/attachment.art'), { - attachment, - }) - ); - } else { - content(`[data-id="${attachment.id}"]`).replaceWith( - art(path.join(__dirname, 'templates/attachment.art'), { - attachment, - }) - ); - } - } - - item.description = content('body').html(); - - return item; - }) - )) { - items.push(item); - } - - return items; - }, -}; diff --git a/lib/v2/mobilism/forums.js b/lib/v2/mobilism/forums.js deleted file mode 100644 index a7e7ed450..000000000 --- a/lib/v2/mobilism/forums.js +++ /dev/null @@ -1,75 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const { toTitleCase } = require('@/utils/common-utils'); -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); -const rootUrl = `https://forum.mobilism.org/viewforum.php?f=`; -const categeoryMap = { - books: { - romance: 1292, - scifi: 1293, - classics: 121, - magazines: 123, - audioBooks: 124, - comics: 311, - }, - android: { - apps: 399, - games: 408, - }, - iphone: { - apps: 316, - games: 320, - }, - ipad: { - apps: 951, - games: 988, - }, -}; -module.exports = async (ctx) => { - const { category, type, fulltext } = ctx.params; - const currentUrl = rootUrl + categeoryMap[category][type]; - const response = await got(currentUrl); - const $ = cheerio.load(cheerio.load(response.data)('tbody')[1]); - const lists = $('tbody > tr'); - const list = lists - .map((index, item) => { - item = $(item); - const title = item.find('td').first().find('a[title]').text(); - const link = new URL(item.find('td').first().find('a[title]').attr('href'), 'https://forum.mobilism.org'); - const author = item.find('td').first().find('a.username-coloured').text(); - const pubDate = item.find('td').first().find('small').text(); - link.searchParams.delete('sid'); - return { - title, - link: link.toString(), - author, - pubDate: /ago|day/.test(pubDate) ? parseRelativeDate(pubDate) : parseDate(pubDate, 'MMM D, YYYY, h:mm a'), - }; - }) - .get() - .sort((a, b) => b.pubDate - a.pubDate) - .slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 35); - // server will return 520 if concurrency > 37 when fulltext is used - let items; - if (fulltext === 'y') { - items = await Promise.all( - list.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got(item.link); - const content = cheerio.load(detailResponse.data); - item.description = content('div.content').html(); - return item; - }) - ) - ); - } else { - items = list; - } - - ctx.state.data = { - title: `Mobilism Forums ${toTitleCase(category)} ${toTitleCase(type)} Release`, - link: currentUrl, - description: `Mobilism Forums ${toTitleCase(category)} ${toTitleCase(type)} RSS`, - item: items, - }; -}; diff --git a/lib/v2/mobilism/maintainer.js b/lib/v2/mobilism/maintainer.js deleted file mode 100644 index 23853f51f..000000000 --- a/lib/v2/mobilism/maintainer.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - '/forums/:category/:type/:fulltext?': ['nitezs'], - '/portal/:type/:fulltext?': ['nitezs'], -}; diff --git a/lib/v2/mobilism/portal.js b/lib/v2/mobilism/portal.js deleted file mode 100644 index f61cd83a3..000000000 --- a/lib/v2/mobilism/portal.js +++ /dev/null @@ -1,54 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const { toTitleCase } = require('@/utils/common-utils'); -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); - -const get = (data) => { - const $ = cheerio.load(data); - const posts = $('div.span9 > section'); - const items = posts - .map((index, item) => { - item = $(item); - const link = new URL(item.find('div.well > a').attr('href'), 'https://forum.mobilism.org'); - const pubDate = item.find('div.well > span.muted > em').text().replace(item.find('div.well > span.muted > em > strong').text(), '').replace(' at ', '').split(' in ')[0]; - link.searchParams.delete('sid'); - return { - title: item.find('div.page-header > h3').text(), - link: link.toString(), - author: item.find('div.well > span.muted > em > strong').text().replace('Posted by: ', ''), - description: item.find('div.well > div.postbody').text(), - pubDate: /ago|day/.test(pubDate) ? parseRelativeDate(pubDate) : parseDate(pubDate, 'MMM D, YYYY, h:mm a'), - }; - }) - .get(); - return items; -}; - -module.exports = async (ctx) => { - const { type, fulltext } = ctx.params; - const url = `https://forum.mobilism.org/portal.php?mode=articles&block=${type}&sk=t&sd=d&start=0`; - const response = await got(url); - const list = get(response.data); - let items; - if (fulltext === 'y') { - items = await Promise.all( - list.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got(item.link); - const content = cheerio.load(detailResponse.data); - item.description = content('div.content').html(); - return item; - }) - ) - ); - } else { - items = list; - } - - ctx.state.data = { - title: `Mobilism Portal ${toTitleCase(type)} Release`, - link: url, - description: `Mobilism Portal ${toTitleCase(type)} RSS`, - item: items, - }; -}; diff --git a/lib/v2/mobilism/radar.js b/lib/v2/mobilism/radar.js deleted file mode 100644 index 63fae5122..000000000 --- a/lib/v2/mobilism/radar.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - 'mobilism.org': { - _name: 'Mobilism', - '.': [ - { - title: '论坛', - docs: 'https://docs.rsshub.app/routes/bbs#mobilism', - source: '/', - }, - { - title: '门户', - docs: 'https://docs.rsshub.app/routes/bbs#mobilism', - source: '/portal.php', - target: (_params, url) => `/mobilism/portal/${new URL(url).searchParams.get('block')}`, - }, - { - title: '电子书', - docs: 'https://docs.rsshub.app/routes/reading#mobilism', - source: '/', - }, - ], - }, -}; diff --git a/lib/v2/mobilism/router.js b/lib/v2/mobilism/router.js deleted file mode 100644 index 0d4647855..000000000 --- a/lib/v2/mobilism/router.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = function (router) { - router.get('/forums/:category/:type/:fulltext?', require('./forums')); - router.get('/portal/:type/:fulltext?', require('./portal')); -}; diff --git a/lib/v2/nmbxd1/forum.js b/lib/v2/nmbxd1/forum.js deleted file mode 100644 index db9cfc5cc..000000000 --- a/lib/v2/nmbxd1/forum.js +++ /dev/null @@ -1,58 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const { parseDate } = require('@/utils/parse-date'); -const timezone = require('@/utils/timezone'); -const { art } = require('@/utils/render'); -const path = require('path'); - -module.exports = async (ctx) => { - const id = ctx.params.id; - const rootUrl = 'https://www.nmbxd1.com'; - const currentUrl = /^\d+$/.test(id) ? `${rootUrl}/Forum/timeline/id/${id}` : `${rootUrl}/f/${id}`; - const response = await got(currentUrl); - const $ = cheerio.load(response.data); - $('.h-threads-img-tool').remove(); - $('.h-threads-item-reply-icon').remove(); - $('.h-admin-tool').remove(); - $('.h-threads-tips').remove(); - $('.h-threads-info-report-btn').remove(); - $('.h-threads-info-reply-btn').remove(); - - const items = $('.h-threads-item') - .get() - .map((item) => { - item = $(item); - // Do not remove the info element to keep the description style consistent. - const info = item.find('.h-threads-item-main .h-threads-info'); - const title = info.find('.h-threads-info-title').text(); - const author = [info.find('.h-threads-info-uid font'), info.find('.h-threads-info-uid')] - .find((elem) => elem.length > 0) - .contents() - .first() - .text() - .replace(/^ID:/, ''); - const category = info.find('spam').text(); - const link = new URL(rootUrl + info.find('.h-threads-info-id').attr('href')); - // cleanup query paramter - link.query = link.search = ''; - const pubDate = timezone(parseDate(info.find('.h-threads-info-createdat').text().replace(/\(.\)/, ' ')), +8); - - return { - title, - author, - category, - description: art(path.join(__dirname, 'templates/description.art'), { - item: item.html(), - }), - pubDate, - link: link.toString(), - }; - }); - - ctx.state.data = { - title: $('title').text(), - link: currentUrl, - description: $('meta[name=description]').attr('content'), - item: items, - }; -}; diff --git a/lib/v2/nmbxd1/maintainer.js b/lib/v2/nmbxd1/maintainer.js deleted file mode 100644 index ec6e77e91..000000000 --- a/lib/v2/nmbxd1/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/:id': ['miles170'], -}; diff --git a/lib/v2/nmbxd1/radar.js b/lib/v2/nmbxd1/radar.js deleted file mode 100644 index e82c24e60..000000000 --- a/lib/v2/nmbxd1/radar.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - 'nmbxd1.com': { - _name: 'X岛匿名版', - www: [ - { - title: '串', - docs: 'https://docs.rsshub.app/routes/bbs#x-dao-ni-ming-ban', - source: ['/Forum/timeline/id/:id', '/f/:id'], - target: '/nmbxd1/:id', - }, - ], - }, -}; diff --git a/lib/v2/nmbxd1/router.js b/lib/v2/nmbxd1/router.js deleted file mode 100644 index 49da3c692..000000000 --- a/lib/v2/nmbxd1/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = (router) => { - router.get('/:id', require('./forum')); -}; diff --git a/lib/v2/nmbxd1/templates/description.art b/lib/v2/nmbxd1/templates/description.art deleted file mode 100644 index e22906784..000000000 --- a/lib/v2/nmbxd1/templates/description.art +++ /dev/null @@ -1,65 +0,0 @@ -