From d3b2fa4ad0c77cf5713f05abe46f2b506336340a Mon Sep 17 00:00:00 2001
From: MisteryMonster <40703811+MisteryMonster@users.noreply.github.com>
Date: Tue, 7 Jul 2020 17:42:42 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20remove=20hk01=E5=91=A8=E6=8A=A5?=
=?UTF-8?q?=EF=BC=8C=E7=8E=B0=E5=9C=A8=E9=9C=80=E8=A6=81=E4=BB=98=E8=B4=B9?=
=?UTF-8?q?=E8=AE=A2=E9=98=85=E4=BA=86=20(#5143)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
assets/radar-rules.js | 8 ----
docs/traditional-media.md | 4 --
lib/router.js | 1 -
lib/routes/hk01/ebook.js | 87 ---------------------------------------
4 files changed, 100 deletions(-)
delete mode 100644 lib/routes/hk01/ebook.js
diff --git a/assets/radar-rules.js b/assets/radar-rules.js
index fcc989c58f..d46951fb5c 100644
--- a/assets/radar-rules.js
+++ b/assets/radar-rules.js
@@ -2008,14 +2008,6 @@
target: '/hk01/tag/:id',
},
],
- ebook: [
- {
- title: '《香港01》周报',
- docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01',
- source: ['/', '/subscribe'],
- target: '/hk01/ebook',
- },
- ],
},
'douban.com': {
_name: '豆瓣',
diff --git a/docs/traditional-media.md b/docs/traditional-media.md
index fa42d807b3..f04733b12c 100644
--- a/docs/traditional-media.md
+++ b/docs/traditional-media.md
@@ -488,10 +488,6 @@ category 对应的关键词有
-### 《香港 01》周报
-
-
-
## 香港電台
### 新聞
diff --git a/lib/router.js b/lib/router.js
index ebea80ff2a..babf1fe141 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -2172,7 +2172,6 @@ router.get('/hk01/channel/:id', require('./routes/hk01/channel'));
router.get('/hk01/issue/:id', require('./routes/hk01/issue'));
router.get('/hk01/tag/:id', require('./routes/hk01/tag'));
router.get('/hk01/hot', require('./routes/hk01/hot'));
-router.get('/hk01/ebook', require('./routes/hk01/ebook'));
// 码农周刊
router.get('/manong-weekly', require('./routes/manong-weekly/issues'));
diff --git a/lib/routes/hk01/ebook.js b/lib/routes/hk01/ebook.js
deleted file mode 100644
index ef47c3b023..0000000000
--- a/lib/routes/hk01/ebook.js
+++ /dev/null
@@ -1,87 +0,0 @@
-const got = require('@/utils/got');
-const dayjs = require('dayjs');
-
-module.exports = async (ctx) => {
- const tokenresponse = await got({
- method: 'get',
- url: `https://emag-api.hk01.com/v1/access_token`,
- });
- const hk01Authorization = tokenresponse.data.data[0].token;
- const response = await got({
- method: 'get',
- url: `https://emag-api.hk01.com/v1/books?devices=web&sourceId=72&p=1&pnum=8&itm_source=service_entrance&itm_medium=web&source_id=72&`,
- headers: {
- Authorization: hk01Authorization,
- },
- });
- const issuedata = response.data.data[0];
- // 获取最近周刊的文章
- const link = `https://emag-api.hk01.com/v1/toc?bookId=${issuedata.book_id}`;
- const cache = await ctx.cache.get(link);
- if (cache) {
- return Promise.resolve(JSON.parse(cache));
- }
-
- const response2 = await got({
- method: 'get',
- url: link,
- headers: {
- Authorization: hk01Authorization,
- },
- });
- // 返回单个的issue下的内容。
- const data2 = response2.data.data;
- const single = await Promise.all(
- data2.map(async (item) => {
- const list2 = item.items;
- // 每个Category列表下所有的文章,返回的articles里,每个Category为一个数组,底下有N个文章object
- const articles = Promise.all(
- list2.map(async (item) => {
- // 单个Category下单个的文章
- const iurl = `https://emag-api.hk01.com/v1/articles?articleId=${item.articleId}`;
- const response3 = await got({
- method: 'get',
- url: iurl,
- headers: {
- Authorization: hk01Authorization,
- },
- });
- const inner = response3.data.data;
- const ititle = inner.title[0].content;
- const istory = inner.story;
- const icat = inner.categoryName;
- const issue = inner.journalName;
- const ilink = `https://ebook.hk01.com/article/${item.articleId}`;
- const idate = dayjs.utc(item.coverImage.match(/com.([0-9]+)./)[1], 'YYYYMMDD');
- const icontent = {
- title: `${issue}|${icat}|${ititle}`,
- link: ilink,
- description: istory,
- pubDate: idate,
- };
- return Promise.resolve(icontent);
- })
- );
- return Promise.resolve(articles);
- })
- );
- ctx.cache.set(link, JSON.stringify(single));
- const list = [];
- single.forEach((issue) => {
- issue.forEach((item) => {
- list.push(item);
- });
- });
-
- ctx.state.data = {
- title: `《香港01》周報`,
- link: `https://ebook.hk01.com`,
-
- item: list.map((item) => ({
- title: item.title,
- description: item.description,
- link: item.link,
- pubDate: item.pubDate,
- })),
- };
-};