feat(route): thecatcity (#11092)

* feat(route): thecatcity

* fix: radar

* fix: default title
This commit is contained in:
Tony
2022-10-14 18:24:07 +04:00
committed by GitHub
parent cb0706b167
commit ed08cefe30
10 changed files with 117 additions and 10 deletions

View File

@@ -764,7 +764,7 @@ Compared to the official one, this feed:
### The Verge ### The Verge
<RouteEn author="HenryQW" example="/verge" path="/verge"> <RouteEn author="HenryQW" example="/theverge" path="/theverge">
Provides a better reading experience (full text articles) over the official one. Provides a better reading experience (full text articles) over the official one.

View File

@@ -1359,7 +1359,7 @@ IPFS 网关有可能失效,那时候换成其他网关。
### The Verge ### The Verge
<Route author="HenryQW" example="/verge" path="/verge"> <Route author="HenryQW" example="/theverge" path="/theverge">
通过提取文章全文,以提供比官方源更佳的阅读体验. 通过提取文章全文,以提供比官方源更佳的阅读体验.
@@ -2950,6 +2950,18 @@ column 为 third 时可选的 category:
</Route> </Route>
## 貓奴日常
### 分類
<Route author="TonyRL" example="/thecatcity" path="/thecatcity/:term?" :paramsDesc="['見下表,留空為全部文章']" radar="1" rssbud="1">
| 貓物分享 | 貓咪新聞 | 養貓大全 | 貓奴景點 | 新手養貓教學 |
| ---- | ---- | ---- | ---- | ------ |
| 1 | 2 | 3 | 4 | 5 |
</Route>
## 梅花网 ## 梅花网
### 作品 ### 作品

View File

@@ -2,13 +2,11 @@ const { categories } = require('./cn/categoryMap');
module.exports = { module.exports = {
'mckinsey.com.cn': { 'mckinsey.com.cn': {
_name: 'McKinsey Greater China', _name: 'McKinsey Greater China',
'.': [ '.': Object.entries(categories).map(([key, value]) => ({
{ title: `${value.name} | 洞见`,
title: '洞见', docs: 'https://docs.rsshub.app/finance.html#mai-ken-xi',
docs: 'https://docs.rsshub.app/finance.html#mai-ken-xi', source: [`/insights/${value.slug}`, '/insights'],
source: ['/insights/:category', '/insights'], target: `/mckinsey/cn/${key}`,
target: (params) => `/mckinsey/cn${params.category ? `/${categories.find((c) => c.slug === params.category).key}` : ''}`, })),
},
],
}, },
}; };

View File

@@ -0,0 +1,48 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const { termsMap } = require('./termsMap');
const baseUrl = 'https://thecatcity.com';
module.exports = async (ctx) => {
const { term } = ctx.params;
const { data } = await got(`${baseUrl}/node_api/v1/articles/posts`, {
searchParams: {
pageId: 977080509047743,
term,
},
});
const list = data.data.posts.map((post) => ({
title: post.title,
description: post.description,
link: `${baseUrl}${post.url}`,
pubDate: parseDate(post.post_date),
guid: post.guid,
api: `${baseUrl}/node_api/v1/articles/${post.id}`,
}));
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.guid, async () => {
const { data } = await got(item.api, {
searchParams: {
pageId: 977080509047743,
},
});
item.description = data.data.post_content;
item.category = [...new Set([...data.data.tags.map((t) => t.name), ...data.data.categories.map((c) => c.name)])];
item.author = data.data.author.display_name;
return item;
})
)
);
ctx.state.data = {
title: termsMap[term] ? termsMap[term].title : termsMap[''].title,
description: '提供貓咪日常照顧、新手準備、貓用品、貓咪醫療、貓飲食與行為等相關知識,以及療癒貓影片、貓趣聞、貓小物流行資訊,不論你是貓奴、還是貓控,一切所需都在貓奴日常找到',
link: baseUrl,
image: 'https://assets.presslogic.com/presslogic-hk-tc/static/favicon.ico',
item: items,
};
};

View File

@@ -0,0 +1,3 @@
module.exports = {
'/:term?': ['TonyRL'],
};

View File

@@ -0,0 +1,13 @@
const { termsMap } = require('./termsMap');
module.exports = {
'thecatcity.com': {
_name: '貓奴日常',
'.': Object.entries(termsMap).map(([key, value]) => ({
title: value.title,
docs: 'https://docs.rsshub.app/new-media.html#mao-nu-ri-chang',
source: [...new Set([value.slug, '/'])],
target: `/thecatcity${key ? `/${key}` : ''}`,
})),
},
};

View File

@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/:term?', require('./index'));
};

View File

@@ -0,0 +1,30 @@
const termsMap = {
'': {
title: 'CatCity 貓奴日常 | 貓咪日常照顧、新手準備、貓用品、貓咪醫療',
slug: '/',
},
1: {
title: '貓物分享|流行小物、貓咪用品',
slug: '/category/cute-item',
},
2: {
title: '貓咪新聞|貓界人氣熱話、貓電影',
slug: '/category/funny-news',
},
3: {
title: '養貓大全|貓咪飲食與醫療、行為心理、貓測驗與冷知識',
slug: '/category/knowledge',
},
4: {
title: '貓奴景點|貓咪咖啡廳與餐廳、貓奴旅行景點推薦',
slug: '/category/hot-spot',
},
5: {
title: '新手養貓教學|養貓準備與花費、日常照顧',
slug: '/category/raise-cats',
},
};
module.exports = {
termsMap,
};