mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 07:12:51 +08:00
feat(route): thecatcity (#11092)
* feat(route): thecatcity * fix: radar * fix: default title
This commit is contained in:
@@ -764,7 +764,7 @@ Compared to the official one, this feed:
|
||||
|
||||
### 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.
|
||||
|
||||
|
||||
@@ -1359,7 +1359,7 @@ IPFS 网关有可能失效,那时候换成其他网关。
|
||||
|
||||
### 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 author="TonyRL" example="/thecatcity" path="/thecatcity/:term?" :paramsDesc="['見下表,留空為全部文章']" radar="1" rssbud="1">
|
||||
|
||||
| 貓物分享 | 貓咪新聞 | 養貓大全 | 貓奴景點 | 新手養貓教學 |
|
||||
| ---- | ---- | ---- | ---- | ------ |
|
||||
| 1 | 2 | 3 | 4 | 5 |
|
||||
|
||||
</Route>
|
||||
|
||||
## 梅花网
|
||||
|
||||
### 作品
|
||||
|
||||
@@ -2,13 +2,11 @@ const { categories } = require('./cn/categoryMap');
|
||||
module.exports = {
|
||||
'mckinsey.com.cn': {
|
||||
_name: 'McKinsey Greater China',
|
||||
'.': [
|
||||
{
|
||||
title: '洞见',
|
||||
'.': Object.entries(categories).map(([key, value]) => ({
|
||||
title: `${value.name} | 洞见`,
|
||||
docs: 'https://docs.rsshub.app/finance.html#mai-ken-xi',
|
||||
source: ['/insights/:category', '/insights'],
|
||||
target: (params) => `/mckinsey/cn${params.category ? `/${categories.find((c) => c.slug === params.category).key}` : ''}`,
|
||||
},
|
||||
],
|
||||
source: [`/insights/${value.slug}`, '/insights'],
|
||||
target: `/mckinsey/cn/${key}`,
|
||||
})),
|
||||
},
|
||||
};
|
||||
|
||||
48
lib/v2/thecatcity/index.js
Normal file
48
lib/v2/thecatcity/index.js
Normal 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,
|
||||
};
|
||||
};
|
||||
3
lib/v2/thecatcity/maintainer.js
Normal file
3
lib/v2/thecatcity/maintainer.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/:term?': ['TonyRL'],
|
||||
};
|
||||
13
lib/v2/thecatcity/radar.js
Normal file
13
lib/v2/thecatcity/radar.js
Normal 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}` : ''}`,
|
||||
})),
|
||||
},
|
||||
};
|
||||
3
lib/v2/thecatcity/router.js
Normal file
3
lib/v2/thecatcity/router.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/:term?', require('./index'));
|
||||
};
|
||||
30
lib/v2/thecatcity/termsMap.js
Normal file
30
lib/v2/thecatcity/termsMap.js
Normal 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,
|
||||
};
|
||||
Reference in New Issue
Block a user