-
Notifications
You must be signed in to change notification settings - Fork 9.2k
添加对shui5.cn的rss适配 #20865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
添加对shui5.cn的rss适配 #20865
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
30fedbf
添加对shui5.cn的rss适配
anuxs 13dc5fd
Merge branch 'DIYgod:master' into master
anuxs 3433a17
Merge branch 'DIYgod:master' into master
anuxs b20ae87
Merge branch 'DIYgod:master' into master
anuxs 92c1a85
Merge branch 'DIYgod:master' into master
anuxs 205a945
Merge branch 'DIYgod:master' into master
anuxs 4a4f5c6
Merge branch 'DIYgod:master' into master
anuxs 343293a
fix(shui5cn): resolve lint issues and clean up tests
anuxs c063cc0
Merge branch 'DIYgod:master' into master
anuxs 7677c92
Merge branch 'DIYgod:master' into master
anuxs 617231a
Merge branch 'DIYgod:master' into master
anuxs 8bc2a87
Merge branch 'DIYgod:master' into master
anuxs b60dcfd
Merge branch 'DIYgod:master' into master
anuxs 5aed3d0
Merge branch 'DIYgod:master' into master
anuxs 17604a1
Merge branch 'DIYgod:master' into master
anuxs be46655
Merge branch 'DIYgod:master' into master
anuxs ebc69d6
Merge branch 'DIYgod:master' into master
anuxs 6bca664
Merge branch 'DIYgod:master' into master
anuxs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
|
|
||
| import { route as bulletinRoute } from './bulletin'; | ||
| import { route as difangCaishuiFaguiRoute } from './difang-caishui-fagui'; | ||
| import { route as faguiJieduRoute } from './fagui-jiedu'; | ||
| import { route as nashuiPingguRoute } from './nashui-pinggu'; | ||
| import { route as nashuiTiaozhenRoute } from './nashui-tiaozhen'; | ||
| import { route as nianduCaishuiFaguiRoute } from './niandu-caishui-fagui'; | ||
| import { route as shuishouYouhuiRoute } from './shuishou-youhui'; | ||
| import { route as shuiwuChouhuaRoute } from './shuiwu-chouhua'; | ||
| import { route as shuiwuJichaAnliRoute } from './shuiwu-jicha-anli'; | ||
| import { route as shuiwuWendaRoute } from './shuiwu-wenda'; | ||
|
|
||
| describe('shui5cn routes', () => { | ||
| const testRoute = async (route: any, routeName: string, expectedTitle: string) => { | ||
| const data = (await route.handler({} as any)) as any; | ||
|
|
||
| // 验证基本结构 | ||
| expect(data).toBeTruthy(); | ||
| expect(data.title).toEqual(expectedTitle); | ||
| expect(data.link).toMatch(/^https:\/\/www\.shui5\.cn\/article\//); | ||
| expect(data.description).toContain('税屋网'); | ||
| expect(data.language).toEqual('zh-CN'); | ||
|
|
||
| // 验证文章列表 | ||
| expect(data.item).toEqual(expect.any(Array)); | ||
| expect(data.item.length).toBeGreaterThan(0); | ||
| expect(data.item.length).toBeLessThanOrEqual(30); | ||
|
|
||
| // 验证第一篇文章的结构 | ||
| const firstItem = data.item[0]; | ||
| expect(firstItem).toHaveProperty('title'); | ||
| expect(firstItem).toHaveProperty('link'); | ||
| expect(firstItem).toHaveProperty('description'); | ||
| expect(firstItem).toHaveProperty('pubDate'); | ||
| expect(firstItem).toHaveProperty('author'); | ||
| expect(firstItem).toHaveProperty('category'); | ||
|
|
||
| // 验证字段类型 | ||
| expect(firstItem.title).toEqual(expect.any(String)); | ||
| expect(firstItem.link).toMatch(/^https?:\/\//); | ||
| expect(firstItem.description).toEqual(expect.any(String)); | ||
| expect(firstItem.author).toEqual(expect.any(String)); | ||
| expect(firstItem.category).toEqual(expect.any(Array)); | ||
| expect(firstItem.category[0]).toEqual('财税'); | ||
|
|
||
| // 验证 description 不为空(除非是错误情况) | ||
| if (!firstItem.description.includes('获取文章内容失败')) { | ||
| expect(firstItem.description.length).toBeGreaterThan(0); | ||
| } | ||
| }; | ||
|
|
||
| it('shuishou-youhui (税收优惠)', async () => { | ||
| await testRoute(shuishouYouhuiRoute, 'shuishou-youhui', '税屋网 - 税收优惠'); | ||
| }, 120000); | ||
|
|
||
| it('shuiwu-chouhua (税务筹划)', async () => { | ||
| await testRoute(shuiwuChouhuaRoute, 'shuiwu-chouhua', '税屋网 - 税务筹划'); | ||
| }, 120000); | ||
|
|
||
| it('shuiwu-jicha-anli (税务稽查案例)', async () => { | ||
| await testRoute(shuiwuJichaAnliRoute, 'shuiwu-jicha-anli', '税屋网 - 税务稽查案例'); | ||
| }, 120000); | ||
|
|
||
| it('nashui-pinggu (纳税评估)', async () => { | ||
| await testRoute(nashuiPingguRoute, 'nashui-pinggu', '税屋网 - 纳税评估'); | ||
| }, 120000); | ||
|
|
||
| it('nashui-tiaozhen (纳税调整)', async () => { | ||
| await testRoute(nashuiTiaozhenRoute, 'nashui-tiaozhen', '税屋网 - 纳税调整'); | ||
| }, 120000); | ||
|
|
||
| it('shuiwu-wenda (税务问答)', async () => { | ||
| await testRoute(shuiwuWendaRoute, 'shuiwu-wenda', '税屋网 - 税务问答'); | ||
| }, 120000); | ||
|
|
||
| it('bulletin (公告)', async () => { | ||
| await testRoute(bulletinRoute, 'bulletin', '税屋网 - 公告'); | ||
| }, 120000); | ||
|
|
||
| it('difang-caishui-fagui (地方财税法规)', async () => { | ||
| await testRoute(difangCaishuiFaguiRoute, 'difang-caishui-fagui', '税屋网 - 地方财税法规'); | ||
| }, 120000); | ||
|
|
||
| it('niandu-caishui-fagui (年度财税法规)', async () => { | ||
| await testRoute(nianduCaishuiFaguiRoute, 'niandu-caishui-fagui', '税屋网 - 年度财税法规'); | ||
| }, 120000); | ||
|
|
||
| it('fagui-jiedu (法规解读)', async () => { | ||
| await testRoute(faguiJieduRoute, 'fagui-jiedu', '税屋网 - 法规解读'); | ||
| }, 120000); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { Route } from '@/types'; | ||
|
|
||
| import { fetchShui5cnCategory } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/bulletin', | ||
| categories: ['finance'], | ||
| example: '/shui5cn/bulletin', | ||
| parameters: {}, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: true, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['shui5.cn/article/Bulletin/'], | ||
| target: '/bulletin', | ||
| }, | ||
| ], | ||
| name: '公告', | ||
| maintainers: ['anuxs'], | ||
| handler, | ||
| url: 'shui5.cn/article/Bulletin/', | ||
| }; | ||
|
|
||
| async function handler() { | ||
| return await fetchShui5cnCategory({ | ||
| categoryPath: 'Bulletin', | ||
| categoryName: '公告', | ||
| categoryLabel: '公告', | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { Route } from '@/types'; | ||
|
|
||
| import { fetchShui5cnCategory } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/difang-caishui-fagui', | ||
| categories: ['finance'], | ||
| example: '/shui5cn/difang-caishui-fagui', | ||
| parameters: {}, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: true, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['shui5.cn/article/DiFangCaiShuiFaGui/'], | ||
| target: '/difang-caishui-fagui', | ||
| }, | ||
| ], | ||
| name: '地方财税法规', | ||
| maintainers: ['anuxs'], | ||
| handler, | ||
| url: 'shui5.cn/article/DiFangCaiShuiFaGui/', | ||
| }; | ||
|
|
||
| async function handler() { | ||
| return await fetchShui5cnCategory({ | ||
| categoryPath: 'DiFangCaiShuiFaGui', | ||
| categoryName: '地方财税法规', | ||
| categoryLabel: '地方财税法规', | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { Route } from "@/types"; | ||
|
|
||
| import { fetchShui5cnCategory } from "./utils"; | ||
|
|
||
| export const route: Route = { | ||
| path: "/fagui-jiedu", | ||
| categories: ["finance"], | ||
| example: "/shui5cn/fagui-jiedu", | ||
| parameters: {}, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: true, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ["shui5.cn/article/FaGuiJieDu/"], | ||
| target: "/fagui-jiedu", | ||
| }, | ||
| ], | ||
| name: "法规解读", | ||
| maintainers: ["anuxs"], | ||
| handler, | ||
| url: "shui5.cn/article/FaGuiJieDu/", | ||
| }; | ||
|
|
||
| async function handler() { | ||
| return await fetchShui5cnCategory({ | ||
| categoryPath: "FaGuiJieDu", | ||
| categoryName: "法规解读", | ||
| categoryLabel: "法规解读", | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import type { Namespace } from '@/types'; | ||
|
|
||
| export const namespace: Namespace = { | ||
| name: '税屋网', | ||
| url: 'shui5.cn', | ||
| lang: 'zh-CN', | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { Route } from '@/types'; | ||
|
|
||
| import { fetchShui5cnCategory } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/nashui-pinggu', | ||
| categories: ['finance'], | ||
| example: '/shui5cn/nashui-pinggu', | ||
| parameters: {}, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: true, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['shui5.cn/article/NaShuiPingGu/'], | ||
| target: '/nashui-pinggu', | ||
| }, | ||
| ], | ||
| name: '纳税评估', | ||
| maintainers: ['anuxs'], | ||
| handler, | ||
| url: 'shui5.cn/article/NaShuiPingGu/', | ||
| }; | ||
|
|
||
| async function handler() { | ||
| return await fetchShui5cnCategory({ | ||
| categoryPath: 'NaShuiPingGu', | ||
| categoryName: '纳税评估', | ||
| categoryLabel: '纳税评估', | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { Route } from '@/types'; | ||
|
|
||
| import { fetchShui5cnCategory } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/nashui-tiaozhen', | ||
| categories: ['finance'], | ||
| example: '/shui5cn/nashui-tiaozhen', | ||
| parameters: {}, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: true, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['shui5.cn/article/NaShuiTiaoZhen/'], | ||
| target: '/nashui-tiaozhen', | ||
| }, | ||
| ], | ||
| name: '纳税调整', | ||
| maintainers: ['anuxs'], | ||
| handler, | ||
| url: 'shui5.cn/article/NaShuiTiaoZhen/', | ||
| }; | ||
|
|
||
| async function handler() { | ||
| return await fetchShui5cnCategory({ | ||
| categoryPath: 'NaShuiTiaoZhen', | ||
| categoryName: '纳税调整', | ||
| categoryLabel: '纳税调整', | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { Route } from '@/types'; | ||
|
|
||
| import { fetchShui5cnCategory } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/niandu-caishui-fagui', | ||
| categories: ['finance'], | ||
| example: '/shui5cn/niandu-caishui-fagui', | ||
| parameters: {}, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: true, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['shui5.cn/article/NianDuCaiShuiFaGui/'], | ||
| target: '/niandu-caishui-fagui', | ||
| }, | ||
| ], | ||
| name: '年度财税法规', | ||
| maintainers: ['anuxs'], | ||
| handler, | ||
| url: 'shui5.cn/article/NianDuCaiShuiFaGui/', | ||
| }; | ||
|
|
||
| async function handler() { | ||
| return await fetchShui5cnCategory({ | ||
| categoryPath: 'NianDuCaiShuiFaGui', | ||
| categoryName: '年度财税法规', | ||
| categoryLabel: '年度财税法规', | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { Route } from '@/types'; | ||
|
|
||
| import { fetchShui5cnCategory } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/shuishou-youhui', | ||
| categories: ['finance'], | ||
| example: '/shui5cn/shuishou-youhui', | ||
| parameters: {}, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: true, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['shui5.cn/article/ShuiShouYouHui/'], | ||
| target: '/shuishou-youhui', | ||
| }, | ||
| ], | ||
| name: '税收优惠', | ||
| maintainers: ['anuxs'], | ||
| handler, | ||
| url: 'shui5.cn/article/ShuiShouYouHui/', | ||
| }; | ||
|
|
||
| async function handler() { | ||
| return await fetchShui5cnCategory({ | ||
| categoryPath: 'ShuiShouYouHui', | ||
| categoryName: '税收优惠', | ||
| categoryLabel: '税收优惠', | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { Route } from '@/types'; | ||
|
|
||
| import { fetchShui5cnCategory } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/shuiwu-chouhua', | ||
| categories: ['finance'], | ||
| example: '/shui5cn/shuiwu-chouhua', | ||
| parameters: {}, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: true, | ||
| antiCrawler: true, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['shui5.cn/article/ShuiWuChouHua/'], | ||
| target: '/shuiwu-chouhua', | ||
| }, | ||
| ], | ||
| name: '税务筹划', | ||
| maintainers: ['anuxs'], | ||
| handler, | ||
| url: 'shui5.cn/article/ShuiWuChouHua/', | ||
| }; | ||
|
|
||
| async function handler() { | ||
| return await fetchShui5cnCategory({ | ||
| categoryPath: 'ShuiWuChouHua', | ||
| categoryName: '税务筹划', | ||
| categoryLabel: '税务筹划', | ||
| }); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / ESLint
Move function definitions to the highest possible scope. Warning