-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/sitdownkevin/RSSHub
- Loading branch information
Showing
7 changed files
with
160 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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,84 @@ | ||
import ofetch from '@/utils/ofetch'; | ||
import { Route } from '@/types'; | ||
import { parseDate } from '@/utils/parse-date'; | ||
import timezone from '@/utils/timezone'; | ||
|
||
const host = 'https://edu.cags.ac.cn'; | ||
|
||
const titles = { | ||
tzgg: '通知公告', | ||
ywjx: '要闻简讯', | ||
zs_bss: '博士生招生', | ||
zs_sss: '硕士生招生', | ||
zs_dxsxly: '大学生夏令营', | ||
}; | ||
|
||
export const route: Route = { | ||
path: '/edu/:category', | ||
categories: ['university'], | ||
example: '/cags/edu/tzgg', | ||
parameters: { | ||
category: '通知频道,可选 tzgg/ywjx/zs_bss/zs_sss/zs_dxsxly', | ||
}, | ||
features: { | ||
antiCrawler: false, | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
name: '研究生院', | ||
maintainers: ['Chikit-L'], | ||
radar: [ | ||
{ | ||
source: ['edu.cags.ac.cn/'], | ||
}, | ||
], | ||
handler, | ||
description: ` | ||
| 通知公告 | 要闻简讯 | 博士生招生 | 硕士生招生 | 大学生夏令营 | | ||
| -------- | -------- | ---------- | ---------- | ------------ | | ||
| tzgg | ywjx | zs_bss | zs_sss | zs_dxsxly | | ||
`, | ||
}; | ||
|
||
async function handler(ctx) { | ||
const category = ctx.req.param('category'); | ||
const title = titles[category]; | ||
|
||
if (!title) { | ||
throw new Error(`Invalid category: ${category}`); | ||
} | ||
|
||
const API_URL = `${host}/api/cms/cmsNews/pageByCmsNavBarId/${category}/1/10/0`; | ||
const response = await ofetch(API_URL); | ||
const data = response.data; | ||
|
||
const items = data.map((item) => { | ||
const id = item.id; | ||
const title = item.title; | ||
|
||
let pubDate = null; | ||
if (item.publishDate) { | ||
pubDate = parseDate(item.publishDate, 'YYYY-MM-DD'); | ||
pubDate = timezone(pubDate, 8); | ||
} | ||
|
||
const link = `${host}/#/dky/view/id=${id}/barId=${category}`; | ||
|
||
return { | ||
title, | ||
description: item.introduction, | ||
link, | ||
guid: link, | ||
pubDate, | ||
}; | ||
}); | ||
|
||
return { | ||
title, | ||
link: `${host}/#/dky/list/barId=${category}/cmsNavCategory=1`, | ||
item: items, | ||
}; | ||
} |
This file contains 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,9 @@ | ||
import type { Namespace } from '@/types'; | ||
|
||
export const namespace: Namespace = { | ||
name: 'Chinese Academy of Geological Sciences', | ||
url: 'cags.cgs.gov.cn', | ||
zh: { | ||
name: '中国地质科学院', | ||
}, | ||
}; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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